module Devise::Models::TokenAuthenticatable::ClassMethods
def authenticate_with_token(attributes)
def authenticate_with_token(attributes) token = attributes[self.token_authentication_key] resource = self.find_for_token_authentication(token) resource if resource.try(:valid_authentication_token?, token) end
def authentication_token
def authentication_token ::Devise.friendly_token end
def find_for_token_authentication(token)
end
self.find_by_authentication_token(token, :conditions => conditions)
conditions = {:active => true}
def self.find_for_token_authentication(token, conditions = {})
== Example:
namedscope to filter records while authenticating.
Overwrite to add customized conditions, create a join, or maybe use a
Find first record based on conditions given (ie by the sign in form).
def find_for_token_authentication(token) self.find(:first, :conditions => { :authentication_token => token}) end