Method: Devise::Models::Confirmable::ClassMethods#send_confirmation_instructions

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

#send_confirmation_instructions(attributes = {}) ⇒ Object

Attempt to find a user by its email. If a record is found, send new confirmation instructions to it. If not, try searching for a user by unconfirmed_email field. If no user is found, returns a new user with an email not found error. Options must contain the user email



231
232
233
234
235
236
237
238
# File 'lib/devise/models/confirmable.rb', line 231

def send_confirmation_instructions(attributes={})
  confirmable = find_by_unconfirmed_email_with_errors(attributes) if reconfirmable
  unless confirmable.try(:persisted?)
    confirmable = find_or_initialize_with_errors(confirmation_keys, attributes, :not_found)
  end
  confirmable.resend_confirmation_token if confirmable.persisted?
  confirmable
end