5

Apparently, after upgrading to Rails 2.3 my session storage has stopped working. I used to have this:

session :session_expires => 3.years.from_now

in my application_controller.rb, but now every time i close the browser (chrome) the session expires. I read from somewhere that session_expires would have changed to expire_after, but

session :expire_after => 3.years.from_now

didn't do any good eihter.

Luke Cowell
  • 703
  • 5
  • 14

2 Answers2

3

Ok, don't know why "session :expire_after => ..." didn't work, but i got it working with this:

ActionController::Base.session_options[:expire_after] = 3.years

  • Sweet worked for me (not it's no longer browser session). Either setting it explicitly there or within the ActionController::Base.session = {} block both worked (within config/initializers/session_store.rb – rogerdpack Jul 27 '11 at 13:53
2

Place this into your ApplicationController and just as your session expires a new one will be generated.

  before_filter :change_session_expiration_time

  def change_session_expiration_time    
      request.session_options[:expire_after] = 1.minute
  end
Özgür
  • 8,077
  • 2
  • 68
  • 66