Module: RailsJwtAuth::Authenticatable::ClassMethods

Defined in:
app/models/concerns/rails_jwt_auth/authenticatable.rb

Instance Method Summary collapse

Instance Method Details

#get_by_token(token) ⇒ Object



28
29
30
31
32
33
34
# File 'app/models/concerns/rails_jwt_auth/authenticatable.rb', line 28

def get_by_token(token)
  if defined?(Mongoid) && ancestors.include?(Mongoid::Document)
    where(auth_tokens: token).first
  elsif defined?(ActiveRecord) && ancestors.include?(ActiveRecord::Base)
    where('auth_tokens like ?', "%#{token}%").first
  end
end