diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-08-24 17:06:02 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-08-24 17:06:02 -0700 |
commit | 9cbb6d2b20a8e3352bedd791fafe3c58f8bef328 (patch) | |
tree | 01a6bba5a0b0f65062d2a6ca53be7b512fe9940f /activerecord | |
parent | bf62077369ba9c35353d046653046d5f5d7dd8f7 (diff) | |
download | rails-9cbb6d2b20a8e3352bedd791fafe3c58f8bef328.tar.gz rails-9cbb6d2b20a8e3352bedd791fafe3c58f8bef328.tar.bz2 rails-9cbb6d2b20a8e3352bedd791fafe3c58f8bef328.zip |
use Hash#fetch to eliminate conditional
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb | 11 |
1 files changed, 3 insertions, 8 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 02459763f7..4e1f0e1d62 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -174,14 +174,9 @@ module ActiveRecord options.assert_valid_keys :requires_new, :joinable 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 + @transaction_joinable = options.fetch(:joinable, true) + requires_new = options[:requires_new] || !last_transaction_joinable + transaction_open = false begin if requires_new || open_transactions == 0 |