small medium large xlarge

13 Jun 2012, 09:08
Burak AKIN (1 post)

Hello i am studying Agile web Developement. In the playtime area; i am trying to view sessions. i used this code in store controller

    def increment_counter
  if session[:counter].nil?
    session[:counter] = 0
  session[:counter] += 1
  def index
    @count = increment_counter
    @products  = Product.all
    @time =
    @shown_message = "You've been here #{@count} times" if increment_counter >5

and this one in the view

<h5><p><%= @shown_message %></p></h5>

. I can manage to see the counter after five times. But the count always increases by two (5,7,9,11).

Can you help me to solve this problem?

You must be logged in to comment