Skip to content

Refactor/prefer params expect#1048

Draft
pdl wants to merge 27 commits into
developfrom
refactor/prefer-params-expect
Draft

Refactor/prefer params expect#1048
pdl wants to merge 27 commits into
developfrom
refactor/prefer-params-expect

Conversation

@pdl
Copy link
Copy Markdown
Contributor

@pdl pdl commented Apr 13, 2026

In almost all cases, prefer params.expect(...) over params.require(...).permit(...).

pdl added 27 commits April 8, 2026 15:51
Copy link
Copy Markdown
Contributor

@leonardow-unep-wcmc leonardow-unep-wcmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reviewed params expect related code.

:representation, :proposal_number
]
],
review_details_attributes: [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in chimera/upgrade-rails-devops

geo_entity_ids: []
]
],
proposal_details_attributes: [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In spec/controllers/admin/documents_controller_spec.rb line 269. Same issue as review_details_attributes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in chimera/upgrade-rails-devops

params.expect(
nomenclature_change_split: [
:event_id, :status,
inputs_attributes: [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was input_attributes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in chimera/upgrade-rails-devops

# :name_reassignments_attributes,
# :distribution_reassignments_attributes,
# :legislation_reassignments_attributes,
output_attributes: output_attribute_names
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key was outputs_attributes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

primary_output_attributes and secondary_output_attributes were single hash not array.
spec/controllers/admin/nomenclature_changes/status_swap_controller_spec.rb (line 91)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in chimera/upgrade-rails-devops

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

Successfully merging this pull request may close these issues.

2 participants