Class: MongoDoc::Validations::ValidatesEmbedded::EmbeddedValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/mongo_doc/validations/validates_embedded.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



9
10
11
12
13
# File 'lib/mongo_doc/validations/validates_embedded.rb', line 9

def validate(record)
  attributes.each do |attr|
    record.errors.add(attr) unless record.send(attr).valid?
  end
end