<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>CHANGELOG</filename>
    </added>
    <added>
      <filename>MIT-LICENSE</filename>
    </added>
    <added>
      <filename>README</filename>
    </added>
    <added>
      <filename>RUNNING_UNIT_TESTS</filename>
    </added>
    <added>
      <filename>Rakefile</filename>
    </added>
    <added>
      <filename>test/abstract_unit.rb</filename>
    </added>
    <added>
      <filename>test/connections/native_db2/connection.rb</filename>
    </added>
    <added>
      <filename>test/connections/native_mysql/connection.rb</filename>
    </added>
    <added>
      <filename>test/connections/native_oci/connection.rb</filename>
    </added>
    <added>
      <filename>test/connections/native_postgresql/connection.rb</filename>
    </added>
    <added>
      <filename>test/connections/native_sqlite/connection.rb</filename>
    </added>
    <added>
      <filename>test/connections/native_sqlite3/connection.rb</filename>
    </added>
    <added>
      <filename>test/connections/native_sqlserver/connection.rb</filename>
    </added>
    <added>
      <filename>test/connections/native_sqlserver_odbc/connection.rb</filename>
    </added>
    <added>
      <filename>test/fixtures/activerecord_paranoid.sqlite</filename>
    </added>
    <added>
      <filename>test/fixtures/categories.yml</filename>
    </added>
    <added>
      <filename>test/fixtures/categories_widgets.yml</filename>
    </added>
    <added>
      <filename>test/fixtures/db_definitions/postgresql.drop.sql</filename>
    </added>
    <added>
      <filename>test/fixtures/db_definitions/postgresql.sql</filename>
    </added>
    <added>
      <filename>test/fixtures/db_definitions/sqlite.drop.sql</filename>
    </added>
    <added>
      <filename>test/fixtures/db_definitions/sqlite.sql</filename>
    </added>
    <added>
      <filename>test/fixtures/widgets.yml</filename>
    </added>
    <added>
      <filename>test/paranoid_test.rb</filename>
    </added>
    <added>
      <filename>test/tests.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,15 +1,44 @@
-module ActiveRecord
+module ActiveRecord #:nodoc:
   module Acts #:nodoc:
+    # Overrides some basic methods for the current model so that calling #destroy sets a 'deleted_at' field to the current timestamp.
+    # This assumes the table has a deleted_at date/time field.  Most normal model operations will work, but there will be some oddities.
+    #
+    #   class Widget &lt; ActiveRecord::Base
+    #     acts_as_paranoid
+    #   end
+    #
+    #   Widget.find(:all)
+    #   # SELECT * FROM widgets WHERE widgets.deleted_at IS NULL
+    #
+    #   Widget.find(:first, :conditions =&gt; ['title = ?', 'test'], :order =&gt; 'title')
+    #   # SELECT * FROM widgets WHERE widgets.deleted_at IS NULL AND title = 'test' ORDER BY title LIMIT 1
+    #
+    #   Widget.find_with_deleted(:all)
+    #   # SELECT * FROM widgets
+    #
+    #   Widget.count
+    #   # SELECT COUNT(*) FROM widgets WHERE widgets.deleted_at IS NULL
+    #
+    #   Widget.count ['title = ?', 'test']
+    #   # SELECT COUNT(*) FROM widgets WHERE widgets.deleted_at IS NULL AND title = 'test'
+    #
+    #   Widget.count_with_deleted
+    #   # SELECT COUNT(*) FROM widgets
+    #
+    #   @widget.destroy
+    #   # UPDATE widgets SET deleted_at = '2005-09-17 17:46:36' WHERE id = 1
+    #
+    #   @widget.destroy!
+    #   # DELETE FROM widgets WHERE id = 1
     module Paranoid
       def self.included(base) # :nodoc:
         base.extend ClassMethods
       end
 
-      # Specify this act 
       module ClassMethods
         def acts_as_paranoid
           class_eval do
-            alias_method :destroy!, :destroy
+            alias_method :destroy_without_callbacks!, :destroy_without_callbacks
             class &lt;&lt; self
               alias_method :find_with_deleted, :find
               alias_method :count_with_deleted, :count
@@ -18,38 +47,50 @@ module ActiveRecord
           end
         end
       end
-    end
     
-    module ParanoidMethods #:nodoc:
-      def self.included(base) # :nodoc:
-        base.extend ClassMethods
-      end
+      module ParanoidMethods #:nodoc:
+        def self.included(base) # :nodoc:
+          base.extend ClassMethods
+        end
       
-      module ClassMethods
-        def find(*args)
-          if [:all, :first].include?(args.first)
-            constrain = &quot;#{table_name}.deleted_at IS NULL&quot;
-            constrains = (scope_constrains.nil? or scope_constrains[:conditions].nil? or scope_constrains[:conditions] == constrain) ?
-              constrain :
-              &quot;#{scope_constrains[:conditions]} AND #{constrain}&quot;
-            constrain(:conditions =&gt; constrains) { return find_with_deleted(*args) }
+        module ClassMethods
+          # 
+          def find(*args)
+            if [:all, :first].include?(args.first)
+              constrain = &quot;#{table_name}.deleted_at IS NULL&quot;
+              constrains = (scope_constrains.nil? or scope_constrains[:conditions].nil? or scope_constrains[:conditions] == constrain) ?
+                constrain :
+                &quot;#{scope_constrains[:conditions]} AND #{constrain}&quot;
+              constrain(:conditions =&gt; constrains) { return find_with_deleted(*args) }
+            end
+            find_with_deleted(*args)
           end
-          find_with_deleted(*args)
-        end
     
-        def count(conditions = nil, joins = nil)
-          constrain(:conditions =&gt; &quot;#{table_name}.deleted_at IS NULL&quot;) { count_with_deleted(conditions, joins) }
+          def count(conditions = nil, joins = nil)
+            constrain(:conditions =&gt; &quot;#{table_name}.deleted_at IS NULL&quot;) { count_with_deleted(conditions, joins) }
+          end
         end
-      end
       
-      def destroy
-        unless new_record?
-          sql = self.class.send(:sanitize_sql,
-            [&quot;UPDATE #{self.class.table_name} SET deleted_at = ? WHERE id = ?&quot;, 
-              self.class.default_timezone == :utc ? Time.now.utc : Time.now, id])
-          self.connection.update(sql)
+        def destroy_without_callbacks
+          unless new_record?
+            sql = self.class.send(:sanitize_sql,
+              [&quot;UPDATE #{self.class.table_name} SET deleted_at = ? WHERE id = ?&quot;, 
+                self.class.default_timezone == :utc ? Time.now.utc : Time.now, id])
+            self.connection.update(sql)
+          end
+          freeze
+        end
+        
+        def destroy_with_callbacks!
+          return false if callback(:before_destroy) == false
+          result = destroy_without_callbacks!
+          callback(:after_destroy)
+          result
+        end
+        
+        def destroy!
+          transaction { destroy_with_callbacks! }
         end
-        freeze
       end
     end
   end
@@ -57,11 +98,4 @@ end
 
 ActiveRecord::Base.class_eval do
   include ActiveRecord::Acts::Paranoid
-end
-
-#ActiveRecord::Associations::HasAndBelongsToManyAssociation.class_eval do
-#  alias_method :find_with_deleted, :find
-#  def find(*args)
-#    constrain(:conditions =&gt; &quot;#{@join_table}.deleted_at IS NULL&quot;) { find_with_deleted(*args) }
-#  end
-#end
\ No newline at end of file
+end
\ No newline at end of file</diff>
      <filename>lib/acts_as_paranoid.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0355a91625eeb3f0ce1e48083c6698aedf8eed70</id>
    </parent>
  </parents>
  <author>
    <name>technoweenie</name>
    <email>technoweenie@567b1171-46fb-0310-a4c9-b4bef9110e78</email>
  </author>
  <url>http://github.com/ooochie/acts_as_paranoid/commit/f62f28d511c1103899e30d804061841531af34ea</url>
  <id>f62f28d511c1103899e30d804061841531af34ea</id>
  <committed-date>2005-09-17T15:57:36-07:00</committed-date>
  <authored-date>2005-09-17T15:57:36-07:00</authored-date>
  <message>finished acts_as_paranoid w/ rdocs and tests

git-svn-id: http://svn.techno-weenie.net/projects/acts_as_paranoid@85 567b1171-46fb-0310-a4c9-b4bef9110e78</message>
  <tree>4e2ff5fe95071a26b181cbd5cbc45475b435d669</tree>
  <committer>
    <name>technoweenie</name>
    <email>technoweenie@567b1171-46fb-0310-a4c9-b4bef9110e78</email>
  </committer>
</commit>
