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.
2 comments:
Nike shoes
MBT
supra footwear
famous footwear
shoe dept
nike air max
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