|
class ApplicationController < ActionController::Base
|
|
before_action :authenticate
|
|
|
|
private
|
|
|
|
def authenticate
|
|
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
|