-
Notifications
You must be signed in to change notification settings - Fork 987
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
fixes #18982 - replace AC::Params#each using one-arg block #4399
fixes #18982 - replace AC::Params#each using one-arg block #4399
Conversation
1fd342a
to
36cc045
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor question inline, other than that seems fine.
params[:host] && params[:host][:host_parameters_attributes] && params[:host][:host_parameters_attributes].each do |attribute| | ||
attribute = attribute[1] if attribute.is_a? Array | ||
Foreman::Deprecation.api_deprecation_warning("Field host_parameters_attributes.nested ignored") unless attribute.delete(:nested).nil? | ||
if params[:host] && params[:host][:host_parameters_attributes] && (attrs = params[:host][:host_parameters_attributes]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not if params[:host] && (attrs = params[:host][:host_parameters_attributes])
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, PR updated with the superfluous condition removed.
ActionController::Parameters#each works differently in Rails 5.0: it no longer yields an array of [key, value] entries for hashes, only the key when given a block with arity of one. This method now iterates over only the values when passed a hash or AC::Parameters instance.
36cc045
to
11ae477
Compare
Thanks @domcleal ! |
ActionController::Parameters#each works differently in Rails 5.0: it no
longer yields an array of [key, value] entries for hashes, only the
key when given a block with arity of one. This method now iterates over
only the values when passed a hash or AC::Parameters instance.