views:

136

answers:

2

I have two models: releases have many elements, and elements belong to releases.

The action I wish to define imports all elements (making copies of them all) from one release into another release.

How do I determine if this action belongs as a member action on the releases controller, or a collection action on the elements controller?

+2  A: 

I would put it on the releases controller. Now, if I can figure out why I would do that...

The best I can verbalize is that since it's always operating on all the elements of a release, rather than ever operating on individual or ad-hoc subsets of elements, it seems to be a release operation rather than an element operation.

chaos
Thanks for your perspective. In the future it may need to operate on subsets of elements. Would that change your answer? I think I am still inclined to put it on the release controller.
Angela
Hmm. I thiiiink I'd move it to the elements controller in that case. What tips me slightly in that direction is that the actual data being altered are (presumably) stored in the elements rather than in the releases.
chaos
A: 

I would put it into an elements controller. The action you're doing is one against the elements not against the releases. This separates your concerns a little more accurately...I think.

Christopher Hazlett