Class: SimplyCouch::Model::Validations::ContainmentValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/simply_couch/model/validations.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



17
18
19
20
21
# File 'lib/simply_couch/model/validations.rb', line 17

def validate_each(record, attribute, value)
  unless Array.wrap(value) - options[:in] == []
    record.errors.add(attribute, :inclusion, **options.except(:in, :within).merge!(:value => value))
  end
end