diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-10 05:41:58 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-12 14:48:02 -0200 |
commit | 505bf59457558b8841013d147f13737e13e00ee7 (patch) | |
tree | 82dbafc13ade291edbbf34dc0d20f984e57b054a /activerecord/test | |
parent | 0d27da5fbd5dc39ec23af51717640d641ff5e48f (diff) | |
download | rails-505bf59457558b8841013d147f13737e13e00ee7.tar.gz rails-505bf59457558b8841013d147f13737e13e00ee7.tar.bz2 rails-505bf59457558b8841013d147f13737e13e00ee7.zip |
Merge pull request #8154 from bogdan/has_one_association_performance
Remove unwanted transaction when has one association is built
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test')
-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 08831a42ba..31aa3788c7 100644 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -173,6 +173,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).scoped.where_values.count |