Report abuse

Index: test/paranoid_test.rb
===================================================================
--- test/paranoid_test.rb       (revision 2932)
+++ test/paranoid_test.rb       (working copy)
@@ -92,7 +92,6 @@

   def test_should_not_count_deleted
     assert_equal 1, Widget.count
-    assert_equal 1, Widget.count(['title=?', 'widget 1'])
     assert_equal 2, Widget.calculate_with_deleted(:count, :all)
   end

@@ -142,19 +141,19 @@
   end

   def test_should_not_override_scopes_when_counting
-    assert_equal 1, Widget.with_scope(:find => { :conditions => "title = 'widget 1'" }) { Widget.count }
-    assert_equal 0, Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) { Widget.count }
-    assert_equal 1, Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) { Widget.calculate_with_deleted(:count, :all) }
+    assert_equal 1, Widget.send(:with_scope, :find => { :conditions => "title = 'widget 1'" }) { Widget.count }
+    assert_equal 0, Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) { Widget.count }
+    assert_equal 1, Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) { Widget.calculate_with_deleted(:count, :all) }
   end

   def test_should_not_override_scopes_when_finding
-    assert_equal [1], Widget.with_scope(:find => { :conditions => "title = 'widget 1'" }) { Widget.find(:all) }.ids
-    assert_equal [],  Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) { Widget.find(:all) }.ids
-    assert_equal [2], Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) { Widget.find_with_deleted(:all) }.ids
+    assert_equal [1], Widget.send(:with_scope, :find => { :conditions => "title = 'widget 1'" }) { Widget.find(:all) }.ids
+    assert_equal [],  Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) { Widget.find(:all) }.ids
+    assert_equal [2], Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) { Widget.find_with_deleted(:all) }.ids
   end

   def test_should_allow_multiple_scoped_calls_when_finding
-    Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) do
+    Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) do
       assert_equal [2], Widget.find_with_deleted(:all).ids
       assert_equal [2], Widget.find_with_deleted(:all).ids, "clobbers the constrain on the unmodified find"
       assert_equal [], Widget.find(:all).ids
@@ -163,7 +162,7 @@
   end

   def test_should_allow_multiple_scoped_calls_when_counting
-    Widget.with_scope(:find => { :conditions => "title = 'deleted widget 2'" }) do
+    Widget.send(:with_scope, :find => { :conditions => "title = 'deleted widget 2'" }) do
       assert_equal 1, Widget.calculate_with_deleted(:count, :all)
       assert_equal 1, Widget.calculate_with_deleted(:count, :all), "clobbers the constrain on the unmodified find"
       assert_equal 0, Widget.count
Index: lib/caboose/acts/paranoid.rb
===================================================================
--- lib/caboose/acts/paranoid.rb        (revision 2932)
+++ lib/caboose/acts/paranoid.rb        (working copy)
@@ -88,6 +88,19 @@
             calculate_with_deleted(:count, *construct_count_options_from_legacy_args(*args))
           end

+          def self.extended(base) #:nodoc:
+            super
+            if base.methods.include?("construct_count_options_from_args")
+              class << base
+                alias_method :count_with_deleted, :count_with_deleted_without_legacy 
+              end
+            end
+          end
+
+          def count_with_deleted_without_legacy(*args)
+            calculate_with_deleted(:count, *construct_count_options_from_args(*args))
+          end
+
           def count(*args)
             with_deleted_scope { count_with_deleted(*args) }
           end