Module: Devise::Models::MultiEmailAuthenticatable::ClassMethods
- Defined in:
- lib/devise/multi_email/models/authenticatable.rb
Instance Method Summary collapse
Instance Method Details
#email_class ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/devise/multi_email/models/authenticatable.rb', line 75 def email_class email_association = reflect_on_association(EMAILS_ASSOCIATION) if email_association email_association.class_name.constantize else raise "#{self.class.name}: Association :#{EMAILS_ASSOCIATION} not found: It might because your declaration is after `devise :multi_email_confirmable`." end end |
#find_first_by_auth_conditions(tainted_conditions, opts = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/devise/multi_email/models/authenticatable.rb', line 61 def find_first_by_auth_conditions(tainted_conditions, opts = {}) email = tainted_conditions.delete(:email) if email && email.is_a?(String) conditions = devise_parameter_filter.filter(tainted_conditions).to_h.merge(opts). reverse_merge(emails: { email: email }) resource = joins(:emails).find_by(conditions) resource.current_login_email = email if resource.respond_to?(:current_login_email=) resource else super(tainted_conditions, opts) end end |