Permalink
Browse files

respond_to? doesn't work here, but method_defined? will

this bug were causing odd things in postgresql. especially in tests.
  • Loading branch information...
1 parent 387780f commit 6afea1188664a1124c668f40ce542a5c8e7f2a6a @ochko ochko committed Jun 21, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/after_commit/connection_adapters.rb
@@ -3,7 +3,7 @@ module ConnectionAdapters
def self.included(base)
base.class_eval do
- if respond_to?(:transaction)
+ if method_defined?(:transaction)
def transaction_with_callback(*args, &block)
# @disable_rollback is set to false at the start of the
# outermost call to #transaction. After committing, it is
@@ -17,7 +17,7 @@ def transaction_with_callback(*args, &block)
end
alias_method_chain :transaction, :callback
- elsif respond_to?(:begin_db_transaction)
+ elsif method_defined?(:begin_db_transaction)
def begin_db_transaction_with_callback(*args, &block)
# @disable_rollback is set to false at the start of the
# outermost call to #transaction. After committing, it is

0 comments on commit 6afea11

Please sign in to comment.