Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fbb9fd555c
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (25 sloc) 0.552 kb
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
protected
def log_in_user(user_id)
session[:user_id] = user_id
end
def log_out_user
session.clear
session[:user_id] = nil
end
def user_logged_in?
!!current_user
end
def force_user_login
redirect_to login_path unless user_logged_in?
end
def current_user
begin
@current_user ||= session[:user_id] ? User.find(session[:user_id]) : nil
rescue Exception => e
nil
end
end
end
Jump to Line
Something went wrong with that request. Please try again.