module ZombieRecord::Restorable::ClassMethods

Public Instance Methods

deleted() click to toggle source

Scopes the relation to only include deleted records.

Returns an ActiveRecord::Relation.

# File lib/zombie_record/restorable.rb, line 167
def deleted
  with_deleted.where("#{quoted_table_name}.deleted_at IS NOT NULL")
end
with_deleted() click to toggle source

Scopes the relation to include both active and deleted records.

Returns an ActiveRecord::Relation.

# File lib/zombie_record/restorable.rb, line 174
def with_deleted
  all.
    unscope(where: :deleted_at).
    extending(WithDeletedAssociationsWrapper)
end