From 386cacd86a9d911de4fb5af6274839110b03ab59 Mon Sep 17 00:00:00 2001 From: Hannes Fostie Date: Wed, 3 Jun 2015 16:42:34 +0200 Subject: [PATCH] WIP: Adds #without_deleted scope --- lib/paranoia.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/paranoia.rb b/lib/paranoia.rb index 174b9e9b..437e67c0 100644 --- a/lib/paranoia.rb +++ b/lib/paranoia.rb @@ -33,6 +33,10 @@ def only_deleted end alias :deleted :only_deleted + def without_deleted + 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 }