The Presenter Pattern - ActivePresenter for Rails

This is pretty sweet.

Rails strictly adheres to the MVC model . . . which is good. Where Rails falls a little bit short is when a view needs to manipulate multiple models. The out of the box Rails behavior is one model to one controller to one view.

But, in practice, you often have views that manipulate multiple models. Thankfully, because Rails is flexible, you can accomplish this in a number of ways. However, it often leads to inconsistent code structure, and fat controllers, or nearly untestable code.

What we needed was a “pattern”. I had heard about the presenter pattern last year at RailsEdge in Chicago. At the time, it was just a concept. I didn’t really get it.

Looking at this post (ActivePresenter), I get it now. And, its implementation is pure elegance. I can't wait to try it out.


About this entry


0 comments: