Sha256: 4ea49293af3874c05368702258b91f3f0ec4265179456f2b365048eb6761e79d
Contents?: true
Size: 474 Bytes
Versions: 12
Compression:
Stored size: 474 Bytes
Contents
module Lines class ApplicationController < ActionController::Base private # sets the current_user if one exists in session def current_user @current_user ||= User.find(session[:user_id]) if session[:user_id] end helper_method :current_user # checks if current user is authorized. Redirects to login_url if not def authorize redirect_to login_url, alert: "Not authorized" if current_user.nil? end end end
Version data entries
12 entries across 12 versions & 1 rubygems