diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-10-28 03:39:18 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-10-28 03:39:18 +0000 |
commit | df0765d8dc013ccd399d994109eaf39be4c24e81 (patch) | |
tree | 2e04db54f654cbad328becdda7e3977f7b74611c /activerecord/test | |
parent | d44ce1cb73ec9671ee4459ac76171ef32198554e (diff) | |
download | rails-df0765d8dc013ccd399d994109eaf39be4c24e81.tar.gz rails-df0765d8dc013ccd399d994109eaf39be4c24e81.tar.bz2 rails-df0765d8dc013ccd399d994109eaf39be4c24e81.zip |
Make sure that << works on has_many associations on unsaved records. Closes #9989 [hasmanyjosh]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8049 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/associations_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index 1fe8d2a417..842d8e453a 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -103,6 +103,13 @@ class AssociationProxyTest < Test::Unit::TestCase assert david.categories.include?(categories(:technology)) end + def test_push_does_not_lose_additions_to_new_record + josh = Author.new(:name => "Josh") + josh.posts << Post.new(:title => "New on Edge", :body => "More cool stuff!") + assert josh.posts.loaded? + assert_equal 1, josh.posts.size + end + def test_save_on_parent_does_not_load_target david = developers(:david) |