Presenters allow you to extract the logic needed for complex views (especially views that require the use of more than one model) into a separate, easily testable class. This helps you write clean code and skinny controllers, among other benefits.
1) The key background material is here:
2) I extended Jay Fields' code by adding methods to combine error messages from different models:
3) An example Presenter, combining a User object and an Account object into a Preference presenter, is here:
4) An example controller, using the Preference presenter, is here:
Also, Jay wrote an excellent recipe for Advanced Rails Recipes that covers this technique.
3 comments:
Nike shoes
MBT
supra footwear
famous footwear
shoe dept
nike air max
It's quite interesting.I will look around for more such post.Thanks for sharing.
nike outlet
nike shoes outlet
all star shoes
nike shoes
adidas outlet
ED hardy clothing
ED Hardy Outlet
ED Hardy
ED Hardy Outlet
online ED Hardy
ED Hardy cheap
vibram five fingers Sprint
vibram five fingers Perfoma
vibram five fingers
vibram five fingers Flow
vibram five fingers Moc
vibram five fingers Prsports
Post a Comment