Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Rails Best Practices
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
flyerhzm  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 15:55
From: flyerhzm <flyer...@gmail.com>
Date: Sun, 8 Nov 2009 07:55:12 -0800 (PST)
Local: Sun 8 Nov 2009 15:55
Subject: Rails Best Practices
Hi all,

Last month, there's a Kungfu Rails Conf in Shanghai, China. And
there's an awesome presentation "Rails Best Practices"
http://www.slideshare.net/ihower/rails-best-practices . Yehuda Katz
also likes this presentation.

Now I'm writing a gem to automatic practices check according to this
presentation.

The project repository is here: http://github.com/flyerhzm/rails_best_practices
And wiki pages are here: http://wiki.github.com/flyerhzm/rails_best_practices

It's a code static parser tool like roodi, flog and flay. You can use
it just type "rails_best_practices ." in the root directory of your
rails app.

The gem is not complete yet, finished about 70%. But you can use it
now, just some check lists are not implemented yet.

Last, I will paste all of the check lists, these check lists are
described detailed in wiki pages:

    *  Lesson 1. Move code from Controller to Model
         1. Move finder to named_scope
         2. Use model association
         3. Use scope access
         4. Add model virtual attribute
         5. Use model callback
         6. Replace Complex Creation with Factory Method
         7. Move Model Logic into the Model
         8. model.collection_model_ids (many-to-many)
         9. Nested Model Forms (one-to-one)
        10. Nested Model Forms (one-to-many)

    * Lesson 2. RESTful Conventions
         1. Overuse route customizations
         2. Needless deep nesting
         3. Not use default route

    * Lesson 3. Model
         1. Keep Finders on Their Own Model
         2. Love named_scope # same as Move finder to named_scope
         3. the Law of Demeter
         4. DRY: metaprogramming
         5. Extract into Module
         6. Extract to composed class
         7. Use Observer

    * Lesson 4. Migration
         1. Isolating Seed Data
         2. Always add DB index

    * Lesson 5. Controller
         1. Use before_filter
         2. DRY Controller

    * Lesson 6. View
         1. Move code into controller
         2. Move code into model
         3. Move code into helper
         4. Replace instance variable with local variable
         5. Use Form Builder
         6. Organize Helper files

Hope you like this gem

Thanks,
Richard Huang


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google