Module: Devise::Models::TokenAuthenticatable::ClassMethods

Defined in:
lib/devise/models/token_authenticatable.rb

Instance Method Summary collapse

Instance Method Details

#authentication_tokenObject

Generate a token checking if one does not already exist in the database.



81
82
83
84
85
86
# File 'lib/devise/models/token_authenticatable.rb', line 81

def authentication_token
  loop do
    token = Devise.friendly_token
    break token unless to_adapter.find_first({ :authentication_token => token })
  end
end

#find_for_token_authentication(conditions) ⇒ Object



76
77
78
# File 'lib/devise/models/token_authenticatable.rb', line 76

def find_for_token_authentication(conditions)
  find_for_authentication(:authentication_token => conditions[token_authentication_key])
end