From 505bf59457558b8841013d147f13737e13e00ee7 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 10 Nov 2012 05:41:58 -0800 Subject: Merge pull request #8154 from bogdan/has_one_association_performance Remove unwanted transaction when has one association is built Conflicts: activerecord/CHANGELOG.md --- activerecord/test/cases/associations/has_one_associations_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/test/cases/associations/has_one_associations_test.rb') 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 -- cgit v1.2.3