Pull to concern

This commit is contained in:
Andrew Tomaka 2024-08-16 19:21:44 -04:00
parent cb47e6bb73
commit 28620e27d7
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
3 changed files with 22 additions and 7 deletions

View file

@ -1,9 +1,3 @@
class ApplicationController < ActionController::Base
before_action :authenticate_user
private
def authenticate_user
Current.user = User.find_by(id: session[:current_user_id])
end
include Authenticatable
end

View file

@ -0,0 +1,13 @@
module Authenticatable
extend ActiveSupport::Concern
included do
before_action :authenticate_user
end
private
def authenticate_user
Current.user = User.find_by(id: session[:current_user_id])
end
end