Ruby on Rails Sunday, April 1, 2012

I'm having an issue with Rails version 3.0.9 and trying to get
persistent cookies to stay for the existing session. I want a 1 year
expire on all sessions as a default.

My existing code in my session_store.rb is this:

MyApplicationName::Application.config.session_store :cookie_store

MyApplicationName::Application.config.session = {

:key => '_myapp_name_session',
:path => '/',
:domain => nil,
:expire_after => 1.years.from_now.utc,
:secure => false,
:httponly => true,
:cookie_only => true,
:secret => 'myLongSecretCode'

}

my Curent User is defined in application controller as:

def current_user
@current_user ||= User.find_by_id(session[:user_id])
end

I have checked my site in firefox using firecookie and it shows the
cookie as session only and after I close the browser and reopen the
browser, I have to log in again.

How do I make this persistent?

Thank you.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment