Refactor/prefer params expect#1048
Conversation
…ial Rails upgrade guides
leonardow-unep-wcmc
left a comment
There was a problem hiding this comment.
Just reviewed params expect related code.
| :representation, :proposal_number | ||
| ] | ||
| ], | ||
| review_details_attributes: [ |
There was a problem hiding this comment.
In spec/controllers/admin/documents_controller_spec.rb line 225:
review_details_attributes: { review_phase_id: review_phase.id }
Look like is a hash not array, not sure if this double-array going to work, or the spec is wrong.
There was a problem hiding this comment.
Fixed in chimera/upgrade-rails-devops
| geo_entity_ids: [] | ||
| ] | ||
| ], | ||
| proposal_details_attributes: [ |
There was a problem hiding this comment.
In spec/controllers/admin/documents_controller_spec.rb line 269. Same issue as review_details_attributes.
There was a problem hiding this comment.
Fixed in chimera/upgrade-rails-devops
| params.expect( | ||
| nomenclature_change_split: [ | ||
| :event_id, :status, | ||
| inputs_attributes: [ |
There was a problem hiding this comment.
was input_attributes?
There was a problem hiding this comment.
Fixed in chimera/upgrade-rails-devops
| # :name_reassignments_attributes, | ||
| # :distribution_reassignments_attributes, | ||
| # :legislation_reassignments_attributes, | ||
| output_attributes: output_attribute_names |
There was a problem hiding this comment.
key was outputs_attributes?
There was a problem hiding this comment.
Fixed in chimera/upgrade-rails-devops
| nomenclature_change_status_swap: [ | ||
| :event_id, :status, | ||
| primary_output_attributes: [ output_attribute_names ], | ||
| secondary_output_attributes: [ output_attribute_names ], |
There was a problem hiding this comment.
primary_output_attributes and secondary_output_attributes were single hash not array.
spec/controllers/admin/nomenclature_changes/status_swap_controller_spec.rb (line 91)
There was a problem hiding this comment.
Fixed in chimera/upgrade-rails-devops
In almost all cases, prefer
params.expect(...)overparams.require(...).permit(...).