Class: QbwcRequests::OrderedFields::SubModelsValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- QbwcRequests::OrderedFields::SubModelsValidator
- Defined in:
- lib/qbwc_requests/ordered_fields.rb
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/qbwc_requests/ordered_fields.rb', line 44 def validate record return true if record.class.attr_order.blank? for field in record.class.attr_order value = record.send(field) if value.respond_to?(:valid?) and value.invalid? for error in value.errors record.errors.add("#{field}##{error}", value.errors.[error] ) end end end end |