Class: Strobe::Resource::AssociationValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/strobe/resource/base.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attr, val) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/strobe/resource/base.rb', line 4

def validate_each(record, attr, val)
  if inst = record.send(attr)
    inst.valid?
    inst.errors.each do |key, msg|
      record.errors.add("#{attr}.#{key}", msg)
    end
  end
end