Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can configure cookie-based sessions to be persistent.

http://api.rubyonrails.org/classes/ActionController/Session/...

For rails 3 in config/initializers/session_store.rb

    Rails.application.config.session_store :cookie_store, :key => '_session', :expire_after => 2.weeks


I'll take a look at this. I know that Rails 3 has a new way of doing things, but every Rails 2.3.x authentication system I've seen uses some kind of remember token. Maybe we're all just doing it wrong. :-)

Update: I don't see any way to persist the session variable (where do the options go in session[:user_id] = user.id?), and I'm a little nervous about doing so, since the whole point of a session is that it doesn't persist. I'll stick with cookies for now. The Rails 3 version of the tutorial will probably use "permanent" cookies as per this blog post: http://m.onkey.org/2010/2/5/signed-and-permanent-cookies-in-...


Well I did roll my own signed cookies using http://gist.github.com/416030

Just a note, that cookie is used by created by rails and used dokuwiki using a custom authenication class I made. (dokuwiki verifies the signing)




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: