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

ParamsWrapper only wrap the accessible attributes when they were set #3900

Merged
merged 2 commits into from
Dec 8, 2011

Conversation

jfturcot
Copy link

@jfturcot jfturcot commented Dec 8, 2011

In ActiveRecord models, the wrapped parameters are only the ones returned by attribute_names but this breaks nested attributes.

It now checks if attr_accessible was set on that model and wrap those instead if it was. We could just manually use the include option to list all the parameters that can be wrapped, but with this modification, we do not need to duplicate this code if attr_accessible was already set.

@josevalim
Copy link
Contributor

Also, could you please add an entry to the CHANGELOG as well, saying you changed params wrapper to consider accessible_attributes which allows nested attributes support? Thanks!

@jfturcot
Copy link
Author

jfturcot commented Dec 8, 2011

I'm not sure if this is where you wanted me to add it to the changelog, this is my first pull request to Rails. Please let me know if I need to put that somewhere else. Thanks a lot!

@josevalim
Copy link
Contributor

We usually add them at the top of the CHANGELOG but this way is great. Congratulations on your first contribuition. :)

josevalim added a commit that referenced this pull request Dec 8, 2011
ParamsWrapper only wrap the accessible attributes when they were set
@josevalim josevalim merged commit bf34a36 into rails:master Dec 8, 2011
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