Class: MarkMapper::Plugins::Validations::AssociatedValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- MarkMapper::Plugins::Validations::AssociatedValidator
- Defined in:
- lib/mark_mapper/plugins/validations.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
78 79 80 81 82 |
# File 'lib/mark_mapper/plugins/validations.rb', line 78 def validate_each(record, attribute, value) if !Array.wrap(value).all? { |c| c.nil? || c.valid?([:context]) } record.errors.add(attribute, :invalid, :message => [:message], :value => value) end end |