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
MONGOID-5328: [WIP] Hash and localized fields assignment should work with ActionController::Parameters
objects
#5237
Conversation
…er parameters. It is necessary to call `#to_h` on the ActiveController::Parameters object, and Hash.evolve looks like the right place to do it. As a side note, to err on the side of security, I think it is better to call `#to_h` rather than `#to_unsafe_h` on the ActiveController::Parameters, which will filter out any unpermitted parameters. I need to test how this works in various scenarios (#permit!) etc.
ActionController::Parameters
objectsActionController::Parameters
objects
ActionController::Parameters
objectsActionController::Parameters
objects
@johnnyshields how do you feel about reworking this PR to take into account all of the new code that went into the mongoization epic? |
@Neilshweky, sure, will be glad to do it. |
(FYI will wait until dust settles on the mongoize/evolve refactoring before handling) |
Is there an update on this? |
@Neilshweky no update unfortunately, I've ended up not needing this for my app (I think we just called |
I've opened #5417 to continue this work |
Thank you! 👍 |
TODO
This PR makes
Object
,Hash
and:localized
field assignment work withActionController::Parameters
objects, which are Hash-like but (as of Rails 5.x) do not inherit from Hash class. It is necessary to call#to_h
on theActionController::Parameters
object, andHash.evolve
looks like the right place to do it.As a side note, to err on the side of security, I think it is better to call
#to_h
rather than#to_unsafe_h
on theActionController::Parameters
, which will filter out any unpermitted parameters. I need to test how this works in various scenarios (#permit!) etc.