Ruby on Rails Monday, April 2, 2012

GIYF:

Search term was 'rails session config', second result seems to indicate that this expire_after option is no longer in the Active Record Session:

http://stackoverflow.com/questions/5860950/setting-session-timeout-in-rails-3

Walter

On Apr 1, 2012, at 12:44 PM, David Moeller wrote:

> 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.
>

--
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