Class: Kongo::Collection
- Inherits:
-
Object
- Object
- Kongo::Collection
- Defined in:
- lib/validate/kongo.rb
Instance Method Summary collapse
-
#validates?(hash) ⇒ Boolean
Returns whether ‘hash` would be a valid model if inserted.
Instance Method Details
#validates?(hash) ⇒ Boolean
Returns whether ‘hash` would be a valid model if inserted.
14 15 16 17 18 19 20 |
# File 'lib/validate/kongo.rb', line 14 def validates?(hash) hash = hash.dup hash['_id'] = BSON::ObjectId.new unless hash.include?('_id') model = ::Kongo::Model.new(hash, coll) # NOTE: raises NoMethodError if the model does not have validations model.validates? end |