Hacker News new | ask | show | jobs
by cheald 5278 days ago
If you're interested in "view models", then check out Draper:

https://github.com/jcasimir/draper

It provides exactly that, and it was a huge "a-ha!" for me when I started using it. Suddenly, things that felt icky to do in a helper (because they were tightly coupled to a model) or in the model (because they rightly belonged in a view helper) had a place to live. My templates are nearly fully devoid of twisting logic now.

Based on my experience, I think that Rails is missing the decorator/view-model piece, and would benefit from it as a core addition, but one of the great things about Rails is that it's easily extensible. Drop the gem in your gemfile, start using decorators, and go home happy.