Created
June 18, 2009 16:46
-
-
Save craigw/131997 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This playing about lead to the following plugin: | |
# http://github.com/craigw/callback_after_commit/tree/master | |
# use that instead. | |
module TransactionCommitCallback | |
def self.included(base) | |
base.send(:alias_method, :transaction_without_callbacks, | |
:transaction) | |
end | |
def transaction(*args) | |
transaction_without_callbacks(*args) | |
run_callbacks :after_commit | |
end | |
end | |
ActiveRecord::Base.send(:define_callbacks, :after_commit) | |
ActiveRecord::ConnectionAdapters::DatabaseStatements.send(:include, TransactionCommitCallback) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment