<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/fixture.rb</filename>
    </added>
    <added>
      <filename>test/unit/find_by_id_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,7 @@
 
+May 23
+= support find by id
+
 May 22
 = support for exists? and with :include_destroy option
 </diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -35,6 +35,20 @@ If you find a bug, a test exposing the bug would be great.
      deprecated, which prevents developers from permanently deleting
      objects this way.  Raw SQL could still delete objects permanently.
      
+     
+= API changes from ActiveRecord::Base
+
+  destroy(user)
+  destroy_all(user,conditions=nil)
+  
+  exists?(id_or_conditions, options = {})
+  
+  DEPRECATED:
+  
+    self.delete
+    self.delete_all
+    
+     
 = Major plugin goals
 
   - test all corner cases of the ActiveRecord methods affected by this plugin</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 
-* change deleted to destroyed everywhere
-  -- can associate 'delete' with permanent, database, etc
+= move model tests to their own subdirectory
+
 = support for :include_destroyed =&gt; true
 
 = test delete_all with conditions
@@ -8,20 +8,29 @@
 = move \app directory to \test to avoid adding models to projects that include this plugin
 = test models: need a namespace to avoid name collisions with models in projects that use this plugin
 
-* Rails 2.1: named scope should exclude deleted objects
-
 === METHODS TO OVERRIDE
 
 ActiveRecord::Base
   exists?
   find
-  find_by_sql
+  find_by_sql  (maybe?)
 
 ActiveRecord::Calculations::ClassMethods
   average
   calculate
   construct_count_options_from_args
-  count
+  count 
   maximum
   minimum
-  sum
\ No newline at end of file
+  sum
+  
+=== TECHNIQUES
+
+Associations
+  belongs_to
+  has_one
+  has_many
+  has_many :through
+  has_and_belongs_to_many
+  
+Named Scope (new in Rails 2.1)
\ No newline at end of file</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,3 @@
 require 'acts_as_indestructible'
+require 'fixture'
 ActiveRecord::Base.send(:include, ActiveRecord::Acts::Indestructible)
\ No newline at end of file</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,19 @@
 module ActiveRecord #:nodoc:
+  
+  class Base
+    # there must be a better place to put this
+    alias_method :super_reload, :reload
+  end
+  
   module Acts #:nodoc:
     module Indestructible #:nodoc:
+      
       def self.included(base)
         base.extend(ClassMethods)
         class &lt;&lt; base
           alias_method :super_calculate, :calculate
           alias_method :super_exists?,   :exists?
+          alias_method :super_find,      :find
         end
       end
       
@@ -38,20 +46,24 @@ module ActiveRecord #:nodoc:
         
         def exists?(id_or_conditions, options = {})
           include_destroyed = options[:include_destroyed]
-          return super_exists?(id_or_conditions) if include_destroyed # revert to normal behaviour
-          case id_or_conditions
-            when Integer, String
-              id_or_conditions = [destroyed_condition+&quot; AND #{quoted_table_name}.id = ?&quot;,id_or_conditions]
-            when Array
-              id_or_conditions[0] = destroyed_condition+&quot; AND &quot;+id_or_conditions[0]
-            when Hash
-              include_destroyed = (id_or_conditions.has_key? :include_destroyed and id_or_conditions[:include_destroyed])
-              unless include_destroyed
-                id_or_conditions[:destroyed_at] = nil
-              end
-              id_or_conditions.delete :include_destroyed
+          if id_or_conditions.is_a?(Hash)
+            include_destroyed = id_or_conditions[:include_destroyed]
+            id_or_conditions.delete :include_destroyed
           end
-          super_exists?(id_or_conditions)
+          options = {}
+          options[:select]            = &quot;#{quoted_table_name}.#{primary_key}&quot;
+          options[:conditions]        = expand_id_conditions(id_or_conditions) # private method; possibly fragile
+          options[:include_destroyed] = include_destroyed          
+          !find(:first, options).nil?
+        end
+        
+        def find(*args)
+          options = args.extract_options!
+          include_destroyed = options[:include_destroyed]
+          return super_find(*args) if include_destroyed # revert to normal behaviour
+          options.delete :include_destroyed
+          args &lt;&lt; options_excluding_destroyed(options)
+          super_find(*args)
         end
         
         #protected
@@ -62,9 +74,12 @@ module ActiveRecord #:nodoc:
         
           def options_excluding_destroyed(options)
             options = Hash.new if options.nil?
-            if options.has_key?(:conditions)
-              if options[:conditions].instance_of? Array
-                options[:conditions][0] = destroyed_condition+&quot; AND &quot;+options[:conditions][0]
+            if options.has_key?(:conditions) and !options[:conditions].nil?
+              case options[:conditions]
+                when Array
+                  options[:conditions][0] = destroyed_condition+&quot; AND &quot;+options[:conditions][0]
+                when Hash
+                  options[:conditions][:destroyed_at] = nil
               else
                 options[:conditions] = destroyed_condition+&quot; AND &quot;+options[:conditions]
               end
@@ -90,7 +105,14 @@ module ActiveRecord #:nodoc:
           save
         end
         
+        def reload(options = nil)
+          options = {} if options.nil?
+          options[:include_destroyed] = true
+          super_reload(options)
+        end
+        
       end
+      
     end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/acts_as_indestructible.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,16 @@
 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 
 goodbye:
-  post: hello
+  id: 3001
+  post_id: 2002 #hello
   body: Bye.
 destroyed:
+  id: 3002
+  post_id: 2002 #hello
   destroyed_at: &lt;%= 3.days.ago.to_s :db %&gt;
   destroyed_by: ryanlowe
-  post: hello
   body: I regretted making this comment.
 destroyed_post:
-  post: destroyed
+  id: 3003
+  post_id: 2001 #destroyed
   body: On a deleted post.
\ No newline at end of file</diff>
      <filename>test/fixtures/indestructible_comments.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,18 @@
 
 destroyed:
+  id: 2001
   destroyed_at: &lt;%= 2.days.ago.to_s :db %&gt;
   destroyed_by: ryanlowe
   title: Destroyed Post
   body: This post is destroyed
 hello:
+  id: 2002
   title: Hello World!
-  body: Not very original, is it?
\ No newline at end of file
+  body: Not very original, is it?
+goodbye:
+  id: 2003
+  title: Goodbye World!
+  body: OK, maybe not.
+no_body:
+  id: 2004
+  title: Just a Title
\ No newline at end of file</diff>
      <filename>test/fixtures/indestructible_posts.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,9 @@
 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
 
 ryanlowe:
+  id: 1001
   username: ryanlowe
   is_admin: true
 tigerwoods:
+  id: 1002
   username: tigerwoods
\ No newline at end of file</diff>
      <filename>test/fixtures/indestructible_users.yml</filename>
    </modified>
    <modified>
      <diff>@@ -8,12 +8,12 @@ class CalculationsTest &lt; ActiveSupport::TestCase
   #
   
   def test_count
-    assert_equal 1, IndestructiblePost.count
+    assert_equal 3, IndestructiblePost.count
     assert_equal 2, IndestructibleComment.count
   end
   
   def test_count_with_conditions
-    assert_equal 1, IndestructiblePost.count(:conditions =&gt; &quot;1=1&quot;)
+    assert_equal 3, IndestructiblePost.count(:conditions =&gt; &quot;1=1&quot;)
     assert_equal 2, IndestructibleComment.count(:conditions =&gt; &quot;1=1&quot;)
   end
 </diff>
      <filename>test/unit/calculations_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,8 +8,8 @@ class IndestructibleCommentTest &lt; ActiveSupport::TestCase
     assert indestructible_comments(:destroyed).valid?
     assert indestructible_comments(:destroyed_post).valid?
     
-    assert_equal indestructible_posts(:hello),     indestructible_comments(:goodbye).post
-    assert_equal indestructible_posts(:hello),     indestructible_comments(:destroyed).post
-    assert_equal indestructible_posts(:destroyed), indestructible_comments(:destroyed_post).post
+    assert_equal indestructible_posts(:hello), indestructible_comments(:goodbye).post
+    assert_equal indestructible_posts(:hello), indestructible_comments(:destroyed).post
+    assert_equal nil,                          indestructible_comments(:destroyed_post).post
   end
 end</diff>
      <filename>test/unit/indestructible_comment_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,8 @@ class IndestructiblePostTest &lt; ActiveSupport::TestCase
   def test_fixtures
     assert indestructible_posts(:destroyed).valid?
     assert indestructible_posts(:hello).valid?
+    assert indestructible_posts(:goodbye).valid?
+    assert indestructible_posts(:no_body).valid?
   end
   
 end</diff>
      <filename>test/unit/indestructible_post_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>75b209cb6604b56e74eed5bc3a2cc78055196d2d</id>
    </parent>
  </parents>
  <author>
    <name>Ryan Lowe</name>
    <email>ryanlowe@gmail.com</email>
  </author>
  <url>http://github.com/ryanlowe/acts_as_indestructible/commit/135d0b28e632ac1311f2acda6f32a232f8de225d</url>
  <id>135d0b28e632ac1311f2acda6f32a232f8de225d</id>
  <committed-date>2008-05-23T19:28:38-07:00</committed-date>
  <authored-date>2008-05-23T19:28:38-07:00</authored-date>
  <message>support find by id</message>
  <tree>24b63e512f57d3ca22ac69d2de5e9f5dd6e89c92</tree>
  <committer>
    <name>Ryan Lowe</name>
    <email>ryanlowe@gmail.com</email>
  </committer>
</commit>
