Subscribe
Tutorial search
Cool Stuff
How would you like to MASTER graphic design by next week?
Click here to find out how
Photoshop Templates
Featured Photoshop templates - professional ready to use designs for your next project
View all templates
Ruby on Rails Tutorials
Tutorials
Stuff
Affiliates
Ruby on Rails Refactoring Tutorials
We hope that you will enjoy our Ruby on Rails Refactoring tutorials. Feel free to contact us if you would like to be a tutorial hero and contribute your own Ruby on Rails Refactoring tutorial to our site. Thank you !
So named_scope is great. It's a quick and clear way to share common SQL fragments within your app by defining them in your models. But one aspect of scopes that might not be immediately apparent is how much logic you can strip from your controllers this way.
Difficulty: 


Keep your controllers clean and forms flexible by adding virtual attributes to your model. This very powerful technique allows you to create form fields which may not directly relate to the database.
Difficulty: 


Learn how to clean up your code through refactoring. This episode will show you how to move code from the view into the model to remove duplication and simplify the view.
Difficulty: 


If you want to change something in the layout on a per-template basis, content_for is your answer! This allows templates to specify view code that can be placed anywhere in a layout.
Difficulty: 


Move a find into the model to clean up the controllers and remove duplication. Also see how you can call these custom find methods through an association.
Difficulty: 

Total Tutorials in Category: 5
