From 319baed48e5ddb6556bcb3a89914dabf87171995 Mon Sep 17 00:00:00 2001 From: sh6khan Date: Fri, 8 May 2015 18:47:42 -0400 Subject: [PATCH] docs for updating nested attributes while creating parent record [ci skip] --- activerecord/lib/active_record/nested_attributes.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 90e37e80d2434..07e0f134aa0ba 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -166,6 +166,11 @@ class TooManyRecords < ActiveRecordError # member.posts.first.title # => '[UPDATED] An, as of yet, undisclosed awesome Ruby documentation browser!' # member.posts.second.title # => '[UPDATED] other post' # + # However, the above applies if the parent model is being updated as well. + # For example, If you wanted to create a +member+ named _joe_ and wanted to + # update the +posts+ at the same time, that would give an + # ActiveRecord::RecordNotFound error. + # # By default the associated records are protected from being destroyed. If # you want to destroy any of the associated records through the attributes # hash, you have to enable it first using the :allow_destroy