Skip to content

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

Merged
merged 2 commits into from Dec 8, 2011

3 participants

@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
Ruby on Rails member

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
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
Ruby on Rails member

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

@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
Something went wrong with that request. Please try again.