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 http://tony.swsnow.net/admin/photos/new 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]   end

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

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

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