lib/devise/token_authenticatable/model.rb in devise-token_authenticatable-0.3.1 vs lib/devise/token_authenticatable/model.rb in devise-token_authenticatable-0.3.2

- old
+ new

@@ -30,11 +30,16 @@ end module ClassMethods def find_for_token_authentication(conditions) - find_for_authentication(authentication_token: conditions[Devise::TokenAuthenticatable.token_authentication_key]) + auth_conditions = conditions.dup + authentication_token = auth_conditions.delete(Devise::TokenAuthenticatable.token_authentication_key) + + find_for_authentication( + auth_conditions.merge(authentication_token: authentication_token) + ) end # Generate a token checking if one does not already exist in the database. def authentication_token loop do @@ -87,9 +92,8 @@ end def ensure_authentication_token_before_save ensure_authentication_token if Devise::TokenAuthenticatable.should_ensure_authentication_token end - end end end