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.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/wKogTsiJUTUJ.
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