Class: CouchRest::Model::Validations::CastedModelValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- CouchRest::Model::Validations::CastedModelValidator
- Defined in:
- lib/couchrest/model/validations/casted_model.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(document, attribute, value) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/couchrest/model/validations/casted_model.rb', line 6 def validate_each(document, attribute, value) values = value.is_a?(Array) ? value : [value] return if values.collect {|doc| doc.nil? || doc.valid? }.all? = { :value => value } [:message] = [:message] if [:message] document.errors.add(attribute, :invalid, ) end |