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

Rails5 - params no longer inherits from HashWithIndifferentAccess #18

Closed
scottbarrow opened this issue Jul 5, 2018 · 4 comments
Closed

Comments

@scottbarrow
Copy link

scottbarrow commented Jul 5, 2018

issue:
undefined method `map' for #<ActionController::Parameters

https://github.com/jasondew/data_table/blob/master/lib/data_table/base.rb#L10
calls controller.params.map.
In Rails 5+ params no longer inherits from HashWithIndifferentAccess. enumerable methods are not available on Strong param objects.

It might not be good enough to simply call to_h since any non permitted params will be excluded from the resulting hash.

@jasondew
Copy link
Owner

jasondew commented Jul 9, 2018

Hi @scottbarrow ! I'm not really using the library anymore but I'd be happy to review a PR to fix this if you have the time. If not, I'll try to have a look at some point. Either way, thanks for reporting the issue!

@scottbarrow
Copy link
Author

well the library needs to be updated to support Rails strong params as opposed to expecting a naked params hash. If the params are not "permitted" the param values are not accessible.

I don't know enough about the gem since I was only doing maintenance updates, however from what I can tell maybe it's better to send data_table_params so that the library only handles relevant and whitelisted params and have the for_data_table caller implement this method?

@jasondew
Copy link
Owner

@scottbarrow I've pushed up a branch that I believe will fix this issue. Can you test and let me know if it works for you? https://github.com/jasondew/data_table/tree/rails5-strong-params-bugfix

@scottbarrow
Copy link
Author

awesome thanks, that should work

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

No branches or pull requests

2 participants