I'm a newbie in rails and ruby. I'm so confused by some conventions in rails~
I wrote a method like this:
def show_session_counter?
if session[:counter] && session[:counter] > 4
end
end
... And want to use the method in application.html.erb like this:
<% if show_session_counter? %>
<li><a href="#"><%= pluralize session[:counter], "time" %></a></li>
<% end %>
First, I tried to put the method in application.controller.rb because I thought the method will be used in application.html.erb. I tried to put it as a normal method and as a private one. Neither work.
Then I put the method in the application_helper.rb and it works.
So my questions is: why the first way doesn't work? Is there any "rails convention" here?
Thank you so much!