Method: Mongoid::Scopable::ClassMethods#with_scope
- Defined in:
- lib/mongoid/scopable.rb
#with_scope(criteria) ⇒ Criteria
Pushes the provided criteria onto the scope stack, and removes it after the provided block is yielded.
224 225 226 227 228 229 230 231 |
# File 'lib/mongoid/scopable.rb', line 224 def with_scope(criteria) Threaded.set_current_scope(criteria, self) begin yield criteria ensure Threaded.set_current_scope(nil, self) end end |