diff options
author | Tristan Dunn <tristanzdunn@gmail.com> | 2009-08-09 19:37:12 -0400 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-10 00:46:16 +0100 |
commit | a0f69722be00cd546558b067054e9e7ae2564274 (patch) | |
tree | 69be303f260134359b61215fdc83e9fedafdcc3b /activerecord/test/cases | |
parent | 0472839d684d836e1e7ecd39722c313410d76d5b (diff) | |
download | rails-a0f69722be00cd546558b067054e9e7ae2564274.tar.gz rails-a0f69722be00cd546558b067054e9e7ae2564274.tar.bz2 rails-a0f69722be00cd546558b067054e9e7ae2564274.zip |
Allow ho:through#build when the owner is a new record [#1749 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/has_one_through_associations_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_one_through_associations_test.rb b/activerecord/test/cases/associations/has_one_through_associations_test.rb index ab6e6d20fc..9aef3eb374 100644 --- a/activerecord/test/cases/associations/has_one_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_through_associations_test.rb @@ -28,6 +28,16 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase assert_not_nil new_member.current_membership assert_not_nil new_member.club end + + def test_creating_association_builds_through_record_for_new + new_member = Member.new(:name => "Jane") + new_member.club = clubs(:moustache_club) + assert new_member.current_membership + assert_equal clubs(:moustache_club), new_member.current_membership.club + assert_equal clubs(:moustache_club), new_member.club + assert new_member.save + assert_equal clubs(:moustache_club), new_member.club + end def test_replace_target_record new_club = Club.create(:name => "Marx Bros") |