diff options
author | Bogdan Gusiev <agresso@gmail.com> | 2012-11-10 15:30:20 +0200 |
---|---|---|
committer | Bogdan Gusiev <agresso@gmail.com> | 2012-11-10 15:30:20 +0200 |
commit | 3cb0f3feed7130225cc169c2b1476acf0b11e066 (patch) | |
tree | d6a2504deb525cf8f4cac8deca8cfa801b58e849 /activerecord/test/cases | |
parent | a002442fbce098ce5ae9597784ab2755bdad111a (diff) | |
download | rails-3cb0f3feed7130225cc169c2b1476acf0b11e066.tar.gz rails-3cb0f3feed7130225cc169c2b1476acf0b11e066.tar.bz2 rails-3cb0f3feed7130225cc169c2b1476acf0b11e066.zip |
Do not create useless database transaction when building `has_one` association.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/has_one_associations_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb index 2d3cb654df..ea1cfa0805 100644 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -206,6 +206,12 @@ class HasOneAssociationsTest < ActiveRecord::TestCase assert_equal account, firm.account end + def test_build_association_dont_create_transaction + assert_no_queries { + Firm.new.build_account + } + end + def test_build_and_create_should_not_happen_within_scope pirate = pirates(:blackbeard) scoped_count = pirate.association(:foo_bulb).scope.where_values.count |