lib/slavery.rb in slavery-1.4.1 vs lib/slavery.rb in slavery-1.4.2

- old
+ new

@@ -64,13 +64,15 @@ master_connection end end def slaveryable? - base_transaction_depth = defined?(ActiveSupport::TestCase) && + @base_transaction_depth ||= begin + defined?(ActiveSupport::TestCase) && ActiveSupport::TestCase.respond_to?(:use_transactional_fixtures) && ActiveSupport::TestCase.try(:use_transactional_fixtures) ? 1 : 0 - inside_transaction = master_connection.open_transactions > base_transaction_depth + end + inside_transaction = master_connection.open_transactions > @base_transaction_depth raise Error.new('on_slave cannot be used inside transaction block!') if inside_transaction !Slavery.disabled end