Module: ZombieRecord::Restorable::ClassMethods
- Defined in:
- lib/zombie_record/restorable.rb
Instance Method Summary collapse
-
#deleted ⇒ Object
Scopes the relation to only include deleted records.
-
#with_deleted ⇒ Object
Scopes the relation to include both active and deleted records.
Instance Method Details
#deleted ⇒ Object
Scopes the relation to only include deleted records.
Returns an ActiveRecord::Relation.
161 162 163 |
# File 'lib/zombie_record/restorable.rb', line 161 def deleted with_deleted.where("#{quoted_table_name}.deleted_at IS NOT NULL") end |
#with_deleted ⇒ Object
Scopes the relation to include both active and deleted records.
Returns an ActiveRecord::Relation.
168 169 170 171 172 |
# File 'lib/zombie_record/restorable.rb', line 168 def with_deleted all. unscope(where: :deleted_at). extending(WithDeletedAssociationsWrapper) end |