Class: ActiveModel::Validations::AssociatedValidator

Inherits:
EachValidator
  • Object
show all
Defined in:
lib/two_factor_auth.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



108
109
110
111
112
# File 'lib/two_factor_auth.rb', line 108

def validate_each(record, attribute, value)
  if Array.wrap(value).reject {|r| r.valid?}.any?
    record.errors.add(attribute, value.errors.full_messages.join("; "), options.merge(:value => value))
  end
end