<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>vendor/after_commit/.gitignore</filename>
    </added>
    <added>
      <filename>vendor/after_commit/LICENSE</filename>
    </added>
    <added>
      <filename>vendor/after_commit/README</filename>
    </added>
    <added>
      <filename>vendor/after_commit/Rakefile</filename>
    </added>
    <added>
      <filename>vendor/after_commit/init.rb</filename>
    </added>
    <added>
      <filename>vendor/after_commit/lib/after_commit.rb</filename>
    </added>
    <added>
      <filename>vendor/after_commit/lib/after_commit/active_record.rb</filename>
    </added>
    <added>
      <filename>vendor/after_commit/lib/after_commit/connection_adapters.rb</filename>
    </added>
    <added>
      <filename>vendor/after_commit/test/after_commit_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,6 +4,7 @@ end
 
 require 'active_record'
 require 'riddle'
+require 'after_commit'
 
 require 'thinking_sphinx/active_record'
 require 'thinking_sphinx/association'</diff>
      <filename>lib/thinking_sphinx.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,57 +11,6 @@ module ThinkingSphinx
       #
       def self.included(base)
         base.class_eval do
-          # The define_callbacks method was added post Rails 2.0.2 - if it
-          # doesn't exist, we define the callback manually
-          #
-          if respond_to?(:define_callbacks)
-            define_callbacks :after_commit
-          else
-            class &lt;&lt; self
-              # Handle after_commit callbacks - call all the registered callbacks.
-              #
-              def after_commit(*callbacks, &amp;block)
-                callbacks &lt;&lt; block if block_given?
-                write_inheritable_array(:after_commit, callbacks)
-              end
-            end
-          end
-          
-          def after_commit
-            # Deliberately blank.
-          end
-          
-          # Normal boolean save wrapped in a handler for the after_commit
-          # callback.
-          # 
-          def save_with_after_commit_callback(*args)
-            value = save_without_after_commit_callback(*args)
-            callback(:after_commit) if value
-            return value
-          end
-          
-          alias_method_chain :save, :after_commit_callback
-          
-          # Forceful save wrapped in a handler for the after_commit callback.
-          #
-          def save_with_after_commit_callback!(*args)
-            value = save_without_after_commit_callback!(*args)
-            callback(:after_commit) if value
-            return value
-          end
-          
-          alias_method_chain :save!, :after_commit_callback
-          
-          # Normal destroy wrapped in a handler for the after_commit callback.
-          #
-          def destroy_with_after_commit_callback
-            value = destroy_without_after_commit_callback
-            callback(:after_commit) if value
-            return value
-          end
-          
-          alias_method_chain :destroy, :after_commit_callback
-          
           private
           
           # Set the delta value for the model to be true.</diff>
      <filename>lib/thinking_sphinx/active_record/delta.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,16 +2,16 @@ DROP TABLE IF EXISTS `people`;
 
 CREATE TABLE `people` (
   `id` int(11) NOT NULL auto_increment,
-  `first_name` varchar(50) NOT NULL,
-  `middle_initial` varchar(10) NOT NULL,
-  `last_name` varchar(50) NOT NULL,
-  `gender` varchar(10) NOT NULL,
-  `street_address` varchar(200) NOT NULL,
-  `city` varchar(100) NOT NULL,
-  `state` varchar(100) NOT NULL,
-  `postcode` varchar(10) NOT NULL,
-  `email` varchar(100) NOT NULL,
-  `birthday` datetime NOT NULL,
+  `first_name` varchar(50) NULL,
+  `middle_initial` varchar(10) NULL,
+  `last_name` varchar(50) NULL,
+  `gender` varchar(10) NULL,
+  `street_address` varchar(200) NULL,
+  `city` varchar(100) NULL,
+  `state` varchar(100) NULL,
+  `postcode` varchar(10) NULL,
+  `email` varchar(100) NULL,
+  `birthday` datetime NULL,
   `team_id` int(11) NULL,
   `team_type` varchar(50) NULL,
   `type` varchar(50) NULL,</diff>
      <filename>spec/fixtures/structure.sql</filename>
    </modified>
    <modified>
      <diff>@@ -1,137 +1,27 @@
 require 'spec/spec_helper'
 
-describe &quot;ThinkingSphinx::ActiveRecord::Delta&quot; do
-  describe &quot;after_commit callback&quot; do
-    before :each do
-      Person.stub_method(:write_inheritable_array =&gt; true)
-    end
+# Ensure after_commit plugin is loaded correctly
+Object.subclasses_of(ActiveRecord::ConnectionAdapters::AbstractAdapter).each { |klass|
+  klass.send(:include, AfterCommit::ConnectionAdapters)
+}
 
-    # This spec only passes with ActiveRecord 2.0.2 or earlier.
-    # it &quot;should add callbacks&quot; do
-    #   Person.after_commit :toggle_delta
-    #   
-    #   Person.should have_received(:write_inheritable_array).with(
-    #     :after_commit, [:toggle_delta]
-    #   )
-    # end
-    
-    it &quot;should have an after_commit method by default&quot; do
-      Person.instance_methods.should include(&quot;after_commit&quot;)
-    end
-  end
-  
-  describe &quot;save_with_after_commit_callback method&quot; do
-    before :each do
-      @person = Person.new
-      @person.stub_methods(
-        :save_without_after_commit_callback =&gt; true,
-        :callback                           =&gt; true
-      )
-    end
-    
-    it &quot;should call the normal save method&quot; do
-      @person.save
-      
-      @person.should have_received(:save_without_after_commit_callback)
-    end
-    
-    it &quot;should call the callbacks if the save was successful&quot; do
-      @person.save
-      
-      @person.should have_received(:callback).with(:after_commit)
-    end
-    
-    it &quot;shouldn't call the callbacks if the save failed&quot; do
-      @person.stub_method(:save_without_after_commit_callback =&gt; false)
-      
-      @person.save
-      
-      @person.should_not have_received(:callback)
-    end
-    
-    it &quot;should return the normal save's result&quot; do
-      @person.save.should be_true
-      
-      @person.stub_method(:save_without_after_commit_callback =&gt; false)
-      
-      @person.save.should be_false
-    end
-  end
-  
-  describe &quot;save_with_after_commit_callback! method&quot; do
-    before :each do
-      @person = Person.new
-      @person.stub_methods(
-        :save_without_after_commit_callback! =&gt; true,
-        :callback                            =&gt; true
-      )
-    end
-    
-    it &quot;should call the normal save! method&quot; do
-      @person.save!
-      
-      @person.should have_received(:save_without_after_commit_callback!)
-    end
+describe &quot;ThinkingSphinx::ActiveRecord::Delta&quot; do
+  it &quot;should call the toggle_delta method after a save&quot; do
+    @beta = Beta.new
+    @beta.stub_method(:toggle_delta =&gt; true)
     
-    it &quot;should call the callbacks if the save! was successful&quot; do
-      @person.save!
-      
-      @person.should have_received(:callback).with(:after_commit)
-    end
+    @beta.save
     
-    it &quot;shouldn't call the callbacks if the save! failed&quot; do
-      @person.stub_method(:save_without_after_commit_callback! =&gt; false)
-      
-      @person.save!
-      
-      @person.should_not have_received(:callback)
-    end
-    
-    it &quot;should return the normal save's result&quot; do
-      @person.save!.should be_true
-      
-      @person.stub_method(:save_without_after_commit_callback! =&gt; false)
-      
-      @person.save!.should be_false
-    end
+    @beta.should have_received(:toggle_delta)
   end
   
-  describe &quot;destroy_with_after_commit_callback method&quot; do
-    before :each do
-      @person = Person.new
-      @person.stub_methods(
-        :destroy_without_after_commit_callback  =&gt; true,
-        :callback                               =&gt; true
-      )
-    end
-    
-    it &quot;should call the normal destroy method&quot; do
-      @person.destroy
-      
-      @person.should have_received(:destroy_without_after_commit_callback)
-    end
+  it &quot;should call the toggle_delta method after a save!&quot; do
+    @beta = Beta.new
+    @beta.stub_method(:toggle_delta =&gt; true)
     
-    it &quot;should call the callbacks if the destroy was successful&quot; do
-      @person.destroy
-      
-      @person.should have_received(:callback).with(:after_commit)
-    end
+    @beta.save!
     
-    it &quot;shouldn't call the callbacks if the destroy failed&quot; do
-      @person.stub_method(:destroy_without_after_commit_callback =&gt; false)
-      
-      @person.destroy
-      
-      @person.should_not have_received(:callback)
-    end
-    
-    it &quot;should return the normal save's result&quot; do
-      @person.destroy.should be_true
-      
-      @person.stub_method(:destroy_without_after_commit_callback =&gt; false)
-      
-      @person.destroy.should be_false
-    end
+    @beta.should have_received(:toggle_delta)
   end
   
   describe &quot;toggle_delta method&quot; do</diff>
      <filename>spec/unit/thinking_sphinx/active_record/delta_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a56912f709e8306add7632435b74192da914c487</id>
    </parent>
  </parents>
  <author>
    <name>Pat Allan</name>
    <email>pat@freelancing-gods.com</email>
  </author>
  <url>http://github.com/jaikoo/thinking-sphinx/commit/29c3b7d976932af9318046d95b00a51a0006ee9e</url>
  <id>29c3b7d976932af9318046d95b00a51a0006ee9e</id>
  <committed-date>2008-10-11T22:50:04-07:00</committed-date>
  <authored-date>2008-10-11T22:50:04-07:00</authored-date>
  <message>Switching to after_commit plugin</message>
  <tree>27cea9220e3c8c3bb94f3e4f516ac9aa9c45af19</tree>
  <committer>
    <name>Pat Allan</name>
    <email>pat@freelancing-gods.com</email>
  </committer>
</commit>
