diff --git a/lib/paranoia.rb b/lib/paranoia.rb index 174b9e9b..b47f0afd 100644 --- a/lib/paranoia.rb +++ b/lib/paranoia.rb @@ -33,6 +33,10 @@ def only_deleted end alias :deleted :only_deleted + def only_active + where(paranoia_column => nil) + end + def restore(id_or_ids, opts = {}) ids = Array(id_or_ids).flatten any_object_instead_of_id = ids.any? { |id| ActiveRecord::Base === id }