<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+* (16 Apr 2009)
+
+Allow :with_deleted and :only_deleted options to work with count and calculate.
+Fixes compatibility with will_paginate. [James Le Cuirot]
+
 * (4 Oct 2007)
 
 Update for Edge rails: remove support for legacy #count args </diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -120,11 +120,19 @@ module Caboose #:nodoc:
           end
 
           def count(*args)
-            with_deleted_scope { count_with_deleted(*args) }
+            with, only = extract_deleted_options(args.last) if args.last.is_a?(Hash)
+            
+            with ? count_with_deleted(*args) :
+              only ? count_only_deleted(*args) :
+                with_deleted_scope { count_with_deleted(*args) }
           end
 
           def calculate(*args)
-            with_deleted_scope { calculate_with_deleted(*args) }
+            with, only = extract_deleted_options(args.last) if args.last.is_a?(Hash)
+            
+            with ? calculate_with_deleted(*args) :
+              only ? calculate_only_deleted(*args) :
+                with_deleted_scope { calculate_with_deleted(*args) }
           end
 
           def delete_all(conditions = nil)
@@ -147,12 +155,16 @@ module Caboose #:nodoc:
           private
             # all find calls lead here
             def find_every(options)
-              options.delete(:with_deleted) ? 
-                find_every_with_deleted(options) :
-                options.delete(:only_deleted) ? 
-                  with_only_deleted_scope { find_every_with_deleted(options) } :
+              with, only = extract_deleted_options(options)
+
+              with ? find_every_with_deleted(options) :
+                only ? with_only_deleted_scope { find_every_with_deleted(options) } :
                   with_deleted_scope { find_every_with_deleted(options) }
             end
+
+            def extract_deleted_options(options)
+              return options.delete(:with_deleted), options.delete(:only_deleted)
+            end
         end
 
         def destroy_without_callbacks</diff>
      <filename>lib/caboose/acts/paranoid.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e90a16f1c8f88aff1ce615b89bb23d61a2e90fc0</id>
    </parent>
  </parents>
  <author>
    <name>James Le Cuirot</name>
    <email>chewi@aura-online.co.uk</email>
  </author>
  <url>http://github.com/technoweenie/acts_as_paranoid/commit/b0a5d2b8ba89eae03f673e4af2e52619260fcc30</url>
  <id>b0a5d2b8ba89eae03f673e4af2e52619260fcc30</id>
  <committed-date>2009-04-16T08:16:22-07:00</committed-date>
  <authored-date>2009-04-16T08:16:22-07:00</authored-date>
  <message>Allow :with_deleted and :only_deleted options to work with count and calculate. Fixes compatibility with will_paginate.</message>
  <tree>7a90c47e10e6b7261a3c812de7c243efd07efe7d</tree>
  <committer>
    <name>James Le Cuirot</name>
    <email>chewi@aura-online.co.uk</email>
  </committer>
</commit>
