Class: Braspag::Order::AssociationValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/cbraspag/core/order.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



88
89
90
91
92
# File 'lib/cbraspag/core/order.rb', line 88

def validate_each(record, attribute, value)
  unless value.respond_to?(:valid?) && value.try(:valid?, self.options[:on])
    record.errors.add attribute, "invalid data"
  end
end