How would you like to MASTER graphic design by next week?
Click here to find out how
Featured Photoshop templates - professional ready to use designs for your next project
View all templates
Ruby on Rails Tutorials
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 !
Simplifying Rails Controllers with named_scopes
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.
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.
Refactoring User Name Part 1
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.
Layouts and content_for
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.
Move Find into Model
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.
Total Tutorials in Category: 5