Hi, I’m rewriting some really old code these days and I’m trying to
adhere to the “fat model, skinny controller” approach.
I’m wondering how much to actually stuff into the model, and if
there’s some rule of thumb. For example, I could do this in a
controller:
def controller_action
MyModel.transaction do
instance.do_stuff
instance.associated_thing.other_stuff
instance.save!
end
end
Or, I could put it all on the model instance:
def do_stuff
MyModel.transaction do
some_methods_here
associated_thing.other_stuff
save!
end
end
Any tips on what’s preferable and when/why?
Thanks.