Rails Best Practices - My Favorites
Contributed by Khurshidali Shaikh on 6 Jul 2011
Here are my favorites slides numbers
- - Move finders to named scope
- - Use model accociation
- - Use scope access
- - Add model virtual attributes
- - Use model callback
- - Replace complex creation with factory method
- - Move model logic to model..absolutely
- - Nested model forms
- - Organize controllers/actions in a RESTful way
- - Overuse route customizations
- - Avoid needless deep nesting
- - Keep finders in their own model
- - Make neat use of named scope
- - DRY: Metaprogramming
- - Create modules for better reusability
- - User observer
- - Always add DB index especially on referenced columns
- - Use filters and DRY
- - DRY controller using Inherited Resources
- - Avoid conding logic in Views. Move as much code to controller, helper or model based on the nature of the code
- - Replace instances variables with locals in partials.
Visit us at Neevtech.com to know more about our offerings.
Tags: railsbestpractices, ror, ruby, Ruby on Rail Development
Leave a Comment