Method: Devise::Models::Confirmable::ClassMethods#confirm_by_token
- Defined in:
- lib/devise/models/confirmable.rb
#confirm_by_token(confirmation_token) ⇒ Object
Find a user by it’s confirmation token and try to confirm it. If no user is found, returns a new user with an error. If the user is already confirmed, create an error for the user Options must have the confirmation_token
149 150 151 152 153 |
# File 'lib/devise/models/confirmable.rb', line 149 def confirm_by_token(confirmation_token) confirmable = find_or_initialize_with_error_by(:confirmation_token, confirmation_token) confirmable.confirm! if confirmable.persisted? confirmable end |