On 17 January 2012 18:19, Agis A. <[email protected]> wrote: > Well I did something like this now, just in order to let the controller > decide with how many visits the counter will appear. > > Controller: >> >> def increment_counter >> session[:counter] ||= 0 >> session[:counter] += 1 >> @times_visited = session[:counter] >> @min_times = 5 >> end > > > Helper: >> >> def display_counter >> "You have visited this page " + pluralize(@times_visited, " time") if >> @times_visited > @min_times >> end > > > then on the view I just use <%= display_counter %>. Isn't that better than > before? Now the @min_times is defined in the controller, isn't that the best > place for it to be decided? I guess I should write it in another method like > counter_settings but for now it's ok I think.
I am not sure that is business logic. If it were it should be in a model not the controller. Is it not the specification of the human interface? There are always grey areas however, the real world does not conform to the MVC concept so there will always be judgments to be made. As long as the basic structure is ok then small details do not really matter. Go with whatever you are most comfortable with. 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.

