Module: Mongoid::Paranoia::ClassMethods
- Defined in:
- lib/mongoid/paranoia.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#criteria(*args) ⇒ Object
Override the default
Criteria
accessor to only get existing documents. -
#deleted ⇒ Object
Find deleted documents.
Instance Method Details
#criteria(*args) ⇒ Object
Override the default Criteria
accessor to only get existing documents. Passes all arguments up to NamedScope.criteria
Returns:
A Criteria
for deleted_at not existing.
87 88 89 |
# File 'lib/mongoid/paranoia.rb', line 87 def criteria(*args) super.where(:deleted_at.exists => false) end |
#deleted ⇒ Object
Find deleted documents
Examples:
<tt>Person.deleted</tt> # all deleted employees
<tt>Company.first.employees.deleted</tt> # works with a join
<tt>Person.deleted.find("4c188dea7b17235a2a000001").first</tt>
98 99 100 |
# File 'lib/mongoid/paranoia.rb', line 98 def deleted where(:deleted_at.exists => true) end |