Class: MongoMapper::Validations::ValidatesInclusionOf
- Inherits:
-
Validatable::ValidationBase
- Object
- Validatable::ValidationBase
- MongoMapper::Validations::ValidatesInclusionOf
- Defined in:
- lib/mongomapper/validations.rb
Instance Method Summary collapse
Instance Method Details
#message(instance) ⇒ Object
64 65 66 |
# File 'lib/mongomapper/validations.rb', line 64 def (instance) super || "is not in the list" end |
#valid?(instance) ⇒ Boolean
56 57 58 59 60 61 62 |
# File 'lib/mongomapper/validations.rb', line 56 def valid?(instance) value = instance[attribute] return true if allow_nil && value.nil? return true if allow_blank && value.blank? within.include?(value) end |