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
[api] Merge! is deprecated #2354
Conversation
Looks like you broke requests... |
Method merge! is deprecated and will be removed in Rails 5.1, as no longer inherits from hash. Using this deprecated behavior exposes potential security problems. If you continue to use this method you may be creating a security vulnerability in your app that can be exploited. Instead, consider using one of these documented methods which are not deprecated: http://api.rubyonrails.org/v5.0.0.1/classes/ActionController/Parameters.html
I've fixed it, but I still don't know why it was failing before. With this code: roles = params[:roles].split(',') if params[:roles]
types = params[:types].split(',') if params[:types]
states = params[:states].split(',') if params[:states]
review_states = params[:reviewstates].split(',') if params[:reviewstates]
ids = params[:ids].split(',').map { |i| i.to_i } if params[:ids]
params = params.merge({states: states, types: types, review_states: review_states, roles: roles, ids: ids}) I get this in the log when running the tests:
Although |
LGTM |
In case that someone is curious.
This is how ruby works: if you have a method called $ irb
>> def foo
>> {}
>> end
=> :foo
>> foo = foo.merge(a: 1)
NoMethodError: undefined method `merge' for nil:NilClass
from (irb):4
from /Users/rafaelfranca/.rbenv/versions/2.3.1/bin/irb:11:in `<main>' And self.params = self.params.merge({states: states, types: types, review_states: review_states, roles: roles, ids: ids}) References: |
Great that you took the effort to figure out the root cause. Well done |
Method merge! is deprecated and will be removed in Rails 5.1, as no longer inherits from hash. Using this deprecated behavior exposes potential security problems. If you continue to use this method you may be creating a security vulnerability in your app that can be exploited. Instead, consider using one of these documented methods which are not deprecated: http://api.rubyonrails.org/v5.0.0.1/classes/ActionController/Parameters.html