Auto-logout after 15 minutes

Hi There,

Im going through the ruby on rails tutorial ‘Railsspace’ at the

There is a :remember_me function that allows a cookie to be set at
login to remember the user. See below:

if @user.remember_me == “1”
cookies[:remember_me] = { :value => “cookie name”,
:expires => 2.minutes.from_now }
user.authorization_token = Digest::SHA1.hexdigest(
cookies[:authorization_token] = {
:value => user.authorization_token,
:expires => 2.minutes.from_now }

When i look in safari’s preferences, I can see that the cookie is set.
Agfter the 2 mins, I refresh the web page, and…

  • Safari removes the cookies, but the user still looks logged in.

Is there a way to amend this to ensure that say, after 15 mins, the
user is automatically logged out.

Can anyone help?

Many Thanks


Use the “session-timeout” plugin.


session_times_out_in 15.minutes, :after_timeout => :do_something

Good luck.

Johalf Farina
+55 (51)8487 1402

Working with

On Tue, Oct 13, 2009 at 6:22 PM, RubyonRails_newbie <

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs