Module: Mongoid::Validatable::Queryable
- Included in:
- UniquenessValidator
- Defined in:
- lib/mongoid/validatable/queryable.rb
Instance Method Summary collapse
-
#with_query(document) ⇒ Object
Wrap the validation inside the an execution block that alert’s the session not to clear its persistence options.
Instance Method Details
#with_query(document) ⇒ Object
Wrap the validation inside the an execution block that alert’s the session not to clear its persistence options.
19 20 21 22 23 24 25 26 27 |
# File 'lib/mongoid/validatable/queryable.rb', line 19 def with_query(document) klass = document.class begin Threaded.begin_execution("#{klass.name}-validate-with-query") yield ensure Threaded.exit_execution("#{klass.name}-validate-with-query") end end |