Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs for updating nested attributes while creating parent record #20082

Merged
merged 1 commit into from
May 18, 2015

Conversation

sh6khan
Copy link
Contributor

@sh6khan sh6khan commented May 8, 2015

This references an issue that I had while trying to update a nested attribute while trying to create a new record in the parent model at the same time with accepts_nested_attributes_for.

I think the reason that Rails doesn't allow this is because of a security issue, so I thought it would be good for every one else to know

@@ -165,6 +165,9 @@ 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, this only 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 error.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Can you note what that error is so users know they aren't hitting some other problem and assume it's this caveat?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure !

@sh6khan sh6khan force-pushed the nested-attributes-docs branch 2 times, most recently from 796b908 to 6b57033 Compare May 9, 2015 20:42
@sh6khan
Copy link
Contributor Author

sh6khan commented May 13, 2015

@eileencodes , are there any other changes that you recommend ?

@eileencodes
Copy link
Member

Yes, sorry I should have mentioned this before, can you wrap to 80 characters? Ping me when you've done that - github doesn't notify me on push, just on comments 😄

@sh6khan
Copy link
Contributor Author

sh6khan commented May 18, 2015

thanks @eileencodes for the feedback, wrapped in 80 characters 😄

eileencodes added a commit that referenced this pull request May 18, 2015
docs for updating nested attributes while creating parent record
@eileencodes eileencodes merged commit 0cae22d into rails:master May 18, 2015
@trosborn
Copy link
Contributor

@eileencodes Should we be using 80 character wrap for all docs and guides? The contributing guides don't appear to specify. Thanks! 😄

@eileencodes
Copy link
Member

@trosborn when you write new docs or touch existing docs they should be 80 characters. PR's that just wrap existing the docs to 80 will be rejected because it's considered a cosmetic change. 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants