diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-03 06:25:39 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-03 06:25:39 +0000 |
commit | 116658e69b9c4a722e6ae8717629b8cd0057db89 (patch) | |
tree | 998f82f091355374ba02f79071e6b5990ac8b713 /activerecord/test | |
parent | 9ed7430b9489dc1e8e695a065fe34e319e3ba2b4 (diff) | |
download | rails-116658e69b9c4a722e6ae8717629b8cd0057db89.tar.gz rails-116658e69b9c4a722e6ae8717629b8cd0057db89.tar.bz2 rails-116658e69b9c4a722e6ae8717629b8cd0057db89.zip |
Fixed that calling HasOneProxy#build_model repeatedly would cause saving to happen (closes #4058) [anna@wota.jp]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3753 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/associations_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index 79c7cc8120..c6cf7807fa 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -158,6 +158,15 @@ class HasOneAssociationsTest < Test::Unit::TestCase assert_equal "can't be empty", account.errors.on("credit_limit") end + def test_build_association_twice_without_saving_affects_nothing + count_of_account = Account.count + firm = Firm.find(:first) + account1 = firm.build_account("credit_limit" => 1000) + account2 = firm.build_account("credit_limit" => 2000) + + assert_equal count_of_account, Account.count + end + def test_create_association firm = Firm.new("name" => "GlobalMegaCorp") firm.save |