Out Of Controller
blog.8thlight.com
blog.8thlight.com
To the presenterFactory, let's go!
http://objology.blogspot.com/2011/09/one-of-best-bits-of-pro...
class StoryService
def self.assign_story(params)
story = Story.find(params[:story_id])
user = User.find(params[:user_id])
story.assign_to(user)
end
end
This example is fairly minimal, but with service classes handling workflow and object coordination instead of the controller, the code is easier to test and reuse.Rails is closest to a Model 2 system: http://en.wikipedia.org/wiki/Model_2