Skip to content

Commit

Permalink
Update docs to make find_for_authentication purpose more clear.
Browse files Browse the repository at this point in the history
  • Loading branch information
José Valim committed Mar 30, 2012
1 parent 25a5631 commit 60d2c6f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/devise/models/authenticatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ def http_authenticatable?(strategy)
end

# Find first record based on conditions given (ie by the sign in form).
# This method is always called during an authentication process but
# it may be wrapped as well. For instance, database authenticatable
# provides a `find_for_database_authentication` that wraps a call to
# this method. This allows you to customize both database authenticatable
# or the whole authenticate stack by customize `find_for_authentication.`
#
# Overwrite to add customized conditions, create a join, or maybe use a
# namedscope to filter records while authenticating.
# Example:
Expand All @@ -167,6 +173,10 @@ def http_authenticatable?(strategy)
# super
# end
#
# Finally, notice that Devise also queries for users in other scenarios
# besides authentication, for example when retrieving an user to send
# an e-mail for password reset. In such cases, find_for_authentication
# is not called.
def find_for_authentication(conditions)
find_first_by_auth_conditions(conditions)
end
Expand Down

0 comments on commit 60d2c6f

Please sign in to comment.