Skip to content

Instantly share code, notes, and snippets.

Created January 18, 2015 19:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
class PustakController < ApplicationController
before_filter :session_expires, :except => [:login, :logout]
before_filter :update_session_time, :except => [:login, :logout]
def index
end
def session_expires
@time_left = (session[:expires_at] - Time.now).to_i
unless @time_left > 0
reset_session
redirect_to login_path
end
end
def update_session_time
session[:expires_at] = 10.seconds.from_now
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment