Thanks for the answere
What is too complex logic ?
I have e.g an action with 4 cases each of about 10 rows concerned with
transforming and testing params values and computing view variables
before rendering the view
Is that good rails practice ?

On 13 Sep, 17:18, Colin Law <[email protected]> wrote:
> On 13 September 2011 15:58, Hans <[email protected]> wrote:
>
> > I have controllers with multiple fucntions per action depending on
> > that they are called from different forms and views.
> > For example a controller shows a place on a map, but depending on if
> > the place is selected from a meny or from an autocomplete field or
> > from some associated model that belongs to place  etc I end up with a
> > fat show action with many cases that is controlled by a :mode flag
> > I would like to refactor that fat controller to a skinny one,
> > Should I divide the show action into many different actions, but the
> > controller will then be as fat as before ?
> > Should I create a new controller, but then I have two controllers that
> > shows places on a map, and that seems not very DRY ?
> > Is there any other solution ?
>
> Thin and fat are relative terms of course.  There is no problem with a
> certain amount of logic in an action provided it is just determining
> what to do next based on information passed to it.  If the logic
> becomes too complex then that is what may benefit from re-factoring in
> some way.
>
> Colin

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to