<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -71,24 +71,42 @@ module AfterCommit
         # after_commit callback can be made from the ConnectionAdapters when
         # the commit for the transaction has finally succeeded. 
         def after_commit_callback
-          @calling_after_commit ||= false
-          return if @calling_after_commit
-          
-          @calling_after_commit = true
-          callback(:after_commit)
-          @calling_after_commit = false
+          call_after_commit_callback :after_commit
         end
         
         def after_commit_on_create_callback
-          callback(:after_commit_on_create)
+          call_after_commit_callback :after_commit_on_create
         end
         
         def after_commit_on_update_callback
-          callback(:after_commit_on_update)
+          call_after_commit_callback :after_commit_on_update
         end
         
         def after_commit_on_destroy_callback
-          callback(:after_commit_on_destroy)
+          call_after_commit_callback :after_commit_on_destroy
+        end
+        
+        private
+        
+        def call_after_commit_callback(call)
+          if can_call_after_commit call
+            callback call
+            clear_after_commit_call call
+          end
+        end
+        
+        def can_call_after_commit(call)
+          @calls ||= {}
+          @calls[call] ||= false
+          if @calls[call]
+            return false
+          else
+            @calls[call] = true
+          end
+        end
+        
+        def clear_after_commit_call(call)
+          @calls[call] = false
         end
       end
     end</diff>
      <filename>vendor/after_commit/lib/after_commit/active_record.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>200e20687ef57f772f81218cd569d8b00009a7ef</id>
    </parent>
  </parents>
  <author>
    <name>Pat Allan</name>
    <email>pat@freelancing-gods.com</email>
  </author>
  <url>http://github.com/yob/thinking-sphinx/commit/0105fa3853395c46910a1f66189f8c980ee9d94e</url>
  <id>0105fa3853395c46910a1f66189f8c980ee9d94e</id>
  <committed-date>2009-02-09T03:34:38-08:00</committed-date>
  <authored-date>2009-02-09T03:34:38-08:00</authored-date>
  <message>Refactoring to allow for other after_commit callback variants</message>
  <tree>5af1ba643d1f05afaced49621afc037229946963</tree>
  <committer>
    <name>Pat Allan</name>
    <email>pat@freelancing-gods.com</email>
  </committer>
</commit>
