Skip to content

Instantly share code, notes, and snippets.

@whiz25
Created January 14, 2020 10:07
Show Gist options
  • Save whiz25/03c67642a34666b03676c2c4d7b591ac to your computer and use it in GitHub Desktop.
Save whiz25/03c67642a34666b03676c2c4d7b591ac to your computer and use it in GitHub Desktop.
module CurrentUserConcern
extend ActiveSupport::Concern
included do
before_action :set_current_user
end
def set_current_user
if session[:user_id]
@current_user = User.find(session[:user_id])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment