lib/devise/multi_email/models/validatable.rb in devise-multi_email-2.0.0 vs lib/devise/multi_email/models/validatable.rb in devise-multi_email-2.0.1
- old
+ new
@@ -59,17 +59,13 @@
private
def propagate_email_errors
email_error_key = self.class.multi_email_association.name
+ email_errors = errors.delete(email_error_key) ||
+ errors.delete("#{email_error_key}.email".to_sym) || []
- if respond_to?("#{email_error_key}_attributes=")
- email_error_key = "#{email_error_key}.email".to_sym
- end
-
- email_errors = errors.delete(email_error_key) || []
-
email_errors.each do |error|
errors.add(:email, error)
end
end
@@ -78,10 +74,10 @@
# All validations used by this module.
VALIDATIONS = [:validates_presence_of, :validates_uniqueness_of, :validates_format_of,
:validates_confirmation_of, :validates_length_of].freeze
def assert_validations_api!(base) #:nodoc:
- unavailable_validations = VALIDATIONS.select{ |v| !base.respond_to?(v) }
+ unavailable_validations = VALIDATIONS.select { |v| !base.respond_to?(v) }
unless unavailable_validations.empty?
raise "Could not use :validatable module since #{base} does not respond " <<
"to the following methods: #{unavailable_validations.to_sentence}."
end