parent
96ca8b7e7c
commit
452be0c49c
10 changed files with 59 additions and 10 deletions
|
@ -1,2 +1,3 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
include Authenticatable
|
||||
end
|
||||
|
|
13
app/controllers/concerns/authenticatable.rb
Normal file
13
app/controllers/concerns/authenticatable.rb
Normal 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]) || GuestUser.new
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue