module Devise::Models::Authenticatable
def self.required_fields(klass)
def self.required_fields(klass) [] end
def active_for_authentication?
def active_for_authentication? true end
def apply_to_attribute_or_variable(attr, method)
def apply_to_attribute_or_variable(attr, method) (self[attr] || send(attr)).try(method) end
def authenticatable_salt
def authenticatable_salt end
def devise_mailer
def devise_mailer Devise.mailer end
def downcase_keys
def downcase_keys self.class.case_insensitive_keys.each { |k| apply_to_attribute_or_variable(k, :downcase!) } end
def inactive_message
def inactive_message :inactive end
def send_devise_notification(notification, opts={})
end
end
@pending_notifications ||= []
def pending_notifications
end
end
devise_mailer.send(n, self).deliver
pending_notifications.each do |n|
def send_pending_notifications
end
pending_notifications << notification
def send_devise_notification(notification)
protected
after_commit :send_pending_notifications
devise :database_authenticatable, :confirmable
class User
deliveries until the after_commit callback is triggered:
you can override send_devise_notification to store the
just after the transaction was committed. To achieve this,
sidekiq, resque, etc), you must add the delivery to the queue
if you are using a queue to deliver e-mails (delayed job,
need to customize the e-mail delivery logic. For instance,
to send a notification/mail. This can be overriden if you
This is an internal method called every time Devise needs
def send_devise_notification(notification, opts={}) devise_mailer.send(notification, self, opts).deliver end
def strip_whitespace
def strip_whitespace self.class.strip_whitespace_keys.each { |k| apply_to_attribute_or_variable(k, :strip!) } end
def unauthenticated_message
def unauthenticated_message :invalid end
def valid_for_authentication?
However, you should not overwrite this method, you should overwrite active_for_authentication?
if a model should be signed in or not.
find_for_authentication are the methods used in a Warden::Strategy to check
Check if the current object is valid for authentication. This method and
def valid_for_authentication? block_given? ? yield : true end