Help with session variables in firefox

I have an action “new” which has a before_filter to reset the
session[:count] variable to 1. I then render this variable in the view
and it is as expected.

in the view their is an link_to_remote which calls the method
extra_image. This function should add 1 to the session variable as
well as rendering some extra html within the page.

However in firefox the session[:count] variable will not be reset to

  1. It keeps adding 1 to its existing value. The only way I can get
    every thing to work as it should is to clear the cache in firefox.

Just to get a little stranger it works fine on my local machine with
firefox but not on the hosting server. Both boxes are running the same
version of mongrel and shockingly to say it works fine in IE (OMG)

I have included the methods from my controller below and if anyone
would like to see the problem in action go to
It will work the first time as the session[:count] variable will start
off at . Just reload the page and the problem will become clear.

class Admin::PhotosController < ApplicationController
before_filter :reset_count, :only => [:new] #resets
session[:count] to 1 before action “new”

def reset_count
session[:count] = 1
return session[:count]

def new
@photo =
@categories = Category.find(:all)
@selected = [1]

def extra_image
session[:count] += 1
render :update do |page|
page.insert_html :bottom, :image_upload, :partial =>
page[:title].replace_html “Add a new photo #{session[:count]}”

It’s hard to see from your code, but it looks to me like you’re
going to extra_image in firefox (hence the always adding 1) and in IE
going to the new action (hence always resetting to 1)

Appreciated my help?
Recommend me on Working With Rails

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs