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

Rails 5 Strong Parameters removes hash access for unpermitted params #134

Open
esb opened this issue Nov 27, 2017 · 3 comments
Open

Rails 5 Strong Parameters removes hash access for unpermitted params #134

esb opened this issue Nov 27, 2017 · 3 comments

Comments

@esb
Copy link

esb commented Nov 27, 2017

The following pull changes the behaviour of to_h for unpermitted params -

rails/rails#28734

This change causes array collections to fail when sorting with the error "unable to convert unpermitted parameters to hash".

/lib/smart_listing.rb (line 72) needs a line to permit the sort parameters before converting them to a hash.

if @options[:array]
  if @sort && !@sort.empty? # when array we sort only by first attribute
    @sort.permit! # Add this line

    i = sort_keys.index{|x| x[0] == @sort.to_h.first[0]}
@vinc
Copy link

vinc commented Dec 6, 2017

Doing self.params = params.permit! in the controller before smart_listing_create also seems to fix the problem.

@Ana06
Copy link

Ana06 commented Jan 15, 2018

This should really be fixed, having to write self.params = params.permit! is horrible. 🙈

@fredZen
Copy link

fredZen commented May 23, 2018

Can somebody close this bug as it was fixed in 1.2.2 by #137 ?

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

4 participants