2024-04-13 10:22:40 +00:00
|
|
|
class ApplicationController < ActionController::Base
|
2024-04-21 14:01:10 +00:00
|
|
|
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
|
2024-04-13 10:22:40 +00:00
|
|
|
end
|