Subscribe
Tutorial search

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 !

Sort by:
Simplifying Rails Controllers with named_scopes
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.
Difficulty:
Virtual Attributes
Virtual Attributes
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:
Refactoring User Name Part 1
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.
Difficulty:
Layouts and content_for
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.
Difficulty:
Move Find into Model
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.
Difficulty:
Total Tutorials in Category: 5