Browse files

Resetting the gemspec info, removing automatic loading of the test he…

…lper, but adding details about it (and related contributors Lars and Joel) to the README.
  • Loading branch information...
1 parent 7849d4e commit 5101f1e4621c853c9e999ffe01d3fa3be44f6773 @pat committed May 12, 2010
Showing with 14 additions and 12 deletions.
  1. +10 −2 README.textile
  2. +0 −5 lib/after_commit.rb
  3. +4 −5 tasks/distribution.rb
@@ -4,7 +4,7 @@ An ActiveRecord/Rails library to add @before_commit@, @after_commit@, @before_ro
h2. Installation
-<pre><code>gem install after_commit --source</code></pre>
+<pre><code>gem install after_commit</code></pre>
h2. Usage
@@ -35,6 +35,13 @@ You can use these just like you would any other callback:
+h2. In Tests
+Keep in mind that transactions are finicky at best in tests, and so there's a helper module to make @after_commit@ play nicely in your testing context. You'll need to add these two lines to your spec/test helper:
+<pre><code>ActiveRecord::Base.send(:include, AfterCommit::AfterSavepoint)
h2. Credits
This code first appeared in a blog post "by Eli Miller":, and was then included in "Thinking Sphinx": by "Pat Allan":, with modifications from Joost Hietbrink. The code was then "put on GitHub as a plugin": by Nick Muerdter, and many people forked and added their own contributions.
@@ -50,4 +57,5 @@ This version (maintained by Pat Allan) includes the following patches:
* before_* callbacks ("Trotter Cashion":
* Gemspec and extended tests, works as a plugin, doesn't load ActiveRecord hooks twice, doesn't add Test environment hook automatically. ("David Yip":
* Exception propagation ("George Ogata":
-* Keeping callbacks focused on the correct transactions ("Benjamin Stein":
+* Keeping callbacks focused on the correct transactions ("Benjamin Stein":
+* Using savepoints for test helper ("Lars Klevan": and "Joel Chippindale":
@@ -68,8 +68,3 @@ def self.collection(collection, connection)
ActiveRecord::Base.send(:include, AfterCommit::ActiveRecord)
-if defined?(RAILS_ENV) && RAILS_ENV == 'test'
- ActiveRecord::Base.send(:include, AfterCommit::AfterSavepoint)
- ActiveRecord::Base.include_after_savepoint_extensions
@@ -11,15 +11,14 @@
end do |gem|
- = 'larsklevan-after_commit'
+ = 'after_commit'
gem.summary = 'after_commit callback for ActiveRecord'
gem.description = %Q{
A Ruby on Rails plugin to add an after_commit callback. This can be used to trigger methods only after the entire transaction is complete.
- Updated with savepoint support for unit testing.
- = ""
- gem.homepage = ""
- gem.authors = ["Nick Muerdter", "David Yip", "Pat Allan", "Lars Klevan"]
+ = ""
+ gem.homepage = ""
+ gem.authors = ["Nick Muerdter", "David Yip", "Pat Allan"]
gem.files = FileList[

0 comments on commit 5101f1e

Please sign in to comment.