aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorSubba Rao Pasupuleti <subbarao.pasupuleti@gmail.com>2010-07-10 12:29:09 -0400
committerJosé Valim <jose.valim@gmail.com>2010-07-21 14:25:19 +0200
commitc0bfa0bfc17f4aa615cd9d1006509e0d84b5692d (patch)
treec5515ed322b1f880c86402ce7aee227c0e6be60e /activerecord/test/cases
parent6ba7d5e6544d636a763a40d1543f96d0e0bd77d5 (diff)
downloadrails-c0bfa0bfc17f4aa615cd9d1006509e0d84b5692d.tar.gz
rails-c0bfa0bfc17f4aa615cd9d1006509e0d84b5692d.tar.bz2
rails-c0bfa0bfc17f4aa615cd9d1006509e0d84b5692d.zip
In nested_attributes when association is not loaded and association
record is saved and then in memory record attributes should be saved [#5053 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/nested_attributes_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb
index 84ab61f591..20bd4f6a76 100644
--- a/activerecord/test/cases/nested_attributes_test.rb
+++ b/activerecord/test/cases/nested_attributes_test.rb
@@ -856,6 +856,12 @@ class TestHasManyAutosaveAssociationWhichItselfHasAutosaveAssociations < ActiveR
@part = @ship.parts.create!(:name => "Mast")
@trinket = @part.trinkets.create!(:name => "Necklace")
end
+
+ test "if association is not loaded and association record is saved and then in memory record attributes should be saved" do
+ @ship.parts_attributes=[{:id => @part.id,:name =>'Deck'}]
+ assert_equal 1, @ship.parts.proxy_target.size
+ assert_equal 'Deck', @ship.parts[0].name
+ end
test "when grandchild changed in memory, saving parent should save grandchild" do
@trinket.name = "changed"