Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adding code to ApplicationController
class ApplicationController < ActionController::Base
....
before_action :authenticate
attr_reader :current_user
private
def authenticate
authenticate_or_request_with_http_token do |token, options|
@current_user = User.joins(:auth_token).find_by(auth_tokens: { value: token })
end
end
....
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment