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.
162 163 164 |
# File 'lib/zombie_record/restorable.rb', line 162 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.
169 170 171 172 173 |
# File 'lib/zombie_record/restorable.rb', line 169 def with_deleted all. unscope(where: :deleted_at). extending(WithDeletedAssociationsWrapper) end |