A Fresh Take on Rails Controllers and Views
stephencelis.com
stephencelis.com
I like this method (it's how I've been doing it for the past 6 months or so) because you do the work once and then don't worry about it for the rest of your controller.
The method I used doesn't let you use method names instead of instance variables, but then again I think it's actually better to use instance variables. In my code I mostly use instance variables for active record objects, whereas I use methods galore. The little @ thus helps me find the active record objects quicker.
For example, every substantial Rails project I've seen has had views that have degenerated into messes of bizarre spaghetti logic (which, in turn, interact with the bizarre spaghetti logic in the controllers, in bizarre, noodly ways). This is mainly due to the fact that there's virtually no enforcement of abstraction boundaries in Rails -- views can directly manipulate the models (whose methods and data are essentially world-writable), which are obtained via instance variables on the controller, which are always implicitly available to the view. Mix in things like shared partials, locals and layouts, and Rails code quickly becomes a maintainability nightmare.