module Avram::SoftDelete::Query
Overview
Add methods for querying/updating soft deleted and kept records.
First include the model module in your model: Avram::SoftDelete::Model
Then add this module your query
class ArticleQuery < Article::BaseQuery
  include Avram::SoftDelete::Query
end
  Defined in:
avram/soft_delete/query.crInstance Method Summary
- 
        #only_kept
        
          
Only return kept records
 - 
        #only_soft_deleted
        
          
Only return soft deleted records
 - 
        #restore : Int64
        
          
Bulk restore records
 - 
        #soft_delete
        
          
Bulk soft delete records
 - #soft_deleted_at
 - 
        #with_soft_deleted
        
          
Returns all records
 
Instance Method Detail
Only return kept records
Kept records are considered "kept/not soft deleted" if the
#soft_deleted_at column is nil
Only return soft deleted records
Soft deleted records are considered "soft deleted" if the
#soft_deleted_at column has a non-nil value
Bulk restore records
Example
This will restore Article records updated in the last week:
ArticleQuery.new.updated_at.gt(1.week.ago).restore
        Bulk soft delete records
Example
This will soft delete all Article record older than 1 year:
ArticleQuery.new.created_at.lt(1.year.ago).soft_delete
        Returns all records
This works be removing where clauses for the #soft_deleted_at column.
That means you can do MyQuery.new.only_kept.with_soft_deleted and you
will get all records, not just the kept ones.