diff options
author | Jakub Kuźma <kuba@ibm.(none)> | 2008-08-21 12:55:35 +0200 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-08-21 15:21:21 +0100 |
commit | ea40f71431a821b2ddb37be6ea3ee7d8dac63b85 (patch) | |
tree | 2a56eb3d76b190d19795fd7f17ca48bc29ba15a0 /activerecord/test/cases/associations | |
parent | 7e4ea5f4a2fd25e06820689688e3db5a4851f8e0 (diff) | |
download | rails-ea40f71431a821b2ddb37be6ea3ee7d8dac63b85.tar.gz rails-ea40f71431a821b2ddb37be6ea3ee7d8dac63b85.tar.bz2 rails-ea40f71431a821b2ddb37be6ea3ee7d8dac63b85.zip |
Fix that has_one natural assignment to already associated record. [#854 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_one_associations_test.rb | 10 |
1 files changed, 10 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 99639849a5..ec06be5eba 100644 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -79,6 +79,16 @@ class HasOneAssociationsTest < ActiveRecord::TestCase assert_raises(ActiveRecord::RecordNotFound) { Account.find(old_account_id) } end + def test_natural_assignment_to_already_associated_record + company = companies(:first_firm) + account = accounts(:signals37) + assert_equal company.account, account + company.account = account + company.reload + account.reload + assert_equal company.account, account + end + def test_assignment_without_replacement apple = Firm.create("name" => "Apple") citibank = Account.create("credit_limit" => 10) |