Skip to content

Commit

Permalink
Merge pull request #20082 from sh6khan/nested-attributes-docs
Browse files Browse the repository at this point in the history
docs for updating nested attributes while creating parent record
  • Loading branch information
eileencodes committed May 18, 2015
2 parents fcae201 + 319baed commit 0cae22d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions activerecord/lib/active_record/nested_attributes.rb
Expand Up @@ -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 <tt>:allow_destroy</tt>
Expand Down

0 comments on commit 0cae22d

Please sign in to comment.