Class: FormObjects::AssociatedValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- FormObjects::AssociatedValidator
- Defined in:
- lib/form_objects/associated_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
3 4 5 6 7 |
# File 'lib/form_objects/associated_validator.rb', line 3 def validate_each(record, attribute, value) if Array[value].flatten.reject { |r| r.valid? }.any? record.errors.add(attribute, :invalid, .merge(:value => value)) end end |