Hello,
This is just a "me too" ... I am just now comfortable enough with
rails to be able to accomplish a task both of those ways, and I have a
tough time figuring out when I should choose on or the other. The
Railscasts from http://railscasts.com/ are quite helpful, that''s how I
have been figuring it out.
Dustin
On Jun 24, 3:47 pm, Kap
<kapkap.fernan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---