16 lines
390 B
Ruby
16 lines
390 B
Ruby
class ApplicationController < ActionController::Base
|
|
before_action :authenticate
|
|
|
|
private
|
|
|
|
def authenticate
|
|
Rails.logger.error "Session: #{session.inspect}"
|
|
if authenticated_user = User.find_by(id: session[:user_id])
|
|
Current.user = authenticated_user
|
|
else
|
|
flash[:alert] = t("not_authenticated")
|
|
redirect_to login_path
|
|
end
|
|
end
|
|
end
|