diff options
author | Hongli Lai (Phusion) <hongli@phusion.nl> | 2009-01-13 16:01:44 +0100 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-01-13 15:58:50 -0800 |
commit | 9bcf01b23c25e640da7908ac8b1b49fbf7d2e51a (patch) | |
tree | 78f7a9bc449265bbf666baafa52bcc9c88c2ffdc /activerecord/lib/active_record/connection_adapters/abstract | |
parent | b281a6a5b2137548501ef590379d7af5f6955d2d (diff) | |
download | rails-9bcf01b23c25e640da7908ac8b1b49fbf7d2e51a.tar.gz rails-9bcf01b23c25e640da7908ac8b1b49fbf7d2e51a.tar.bz2 rails-9bcf01b23c25e640da7908ac8b1b49fbf7d2e51a.zip |
Fix PostgreSQL unit test failures that only occur when using the old 'postgres' driver.
[#1748 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 39118583bd..08601da00a 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -89,7 +89,7 @@ module ActiveRecord # - The block will be run without doing anything. All database statements # that happen within the block are effectively appended to the already # open database transaction. - # - However, if +requires_new+ is set, the block will be wrapped in a + # - However, if +:requires_new+ is set, the block will be wrapped in a # database savepoint acting as a sub-transaction. # # === Caveats @@ -113,8 +113,12 @@ module ActiveRecord def transaction(options = {}) options.assert_valid_keys :requires_new, :joinable - last_transaction_joinable, @transaction_joinable = - @transaction_joinable, options[:joinable] || true + last_transaction_joinable = @transaction_joinable + if options.has_key?(:joinable) + @transaction_joinable = options[:joinable] + else + @transaction_joinable = true + end requires_new = options[:requires_new] || !last_transaction_joinable transaction_open = false @@ -141,7 +145,7 @@ module ActiveRecord rollback_to_savepoint end end - raise unless database_transaction_rollback.is_a? ActiveRecord::Rollback + raise unless database_transaction_rollback.is_a?(ActiveRecord::Rollback) end ensure @transaction_joinable = last_transaction_joinable |