Class: AssociatedValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/inflorm/associated_validator.rb

Overview

TODO see if ActiveModel lets you register a validation without polluting global namespace

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



5
6
7
8
9
# File 'lib/inflorm/associated_validator.rb', line 5

def validate_each(record, attribute, value)
  value.respond_to?(:to_ary) ?
    validate_many(record, attribute, value) :
    validate_one(record, attribute, value)
end