Re:Out Of Controller
by rhizome on Saturday October 22, 2011 @07:26PM
(#3144610)
See, this strikes me as CS-driven code smell. Why not use an association between User and Story (maybe through :assignments) and just `user.stories.create(...)` or `user.assignments.create(:story => story)` ? No spurious class necessary.
[ Parent
| on HN ]
Re:Out Of Controller
by dan_manges on Saturday October 22, 2011 @11:17PM
(#3145084)
That is probably how you would do it in this case, but in more complex scenarios, a simple association wouldn't be sufficient. In those cases, putting the code into a service instead of the controller will make the code easier to test and reuse.
What's an example that exceeds the functionality of associations?