Rails Course: Update strong params to use new Rails 8 method #29127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because
Rails 8 introduced a slightly different (and better/more secure) syntax for strong parameters (see: rails changelog)
This method is mentioned in their updated Rails guides (which are part of learner's assigned reading) as the preferred way to handle strong parameters. This is causing confusion as there's a discrepancy with what learners read about strong parameters in the lesson vs. in the rails guides. We could point learners to an older version of the guides on that reading, but I think this is a simple enough fix and doesn't introduce any (easily forgettable) maintenance overhead of eventually needing to go back and set the guides back to default/modern state.
This PR
#expect
syntax.permit().require()
chain as an older alternative that learners may run into.params
is inside of a controller.Issue
Closes #29121
Additional Information
Pull Request Requirements
location of change: brief description of change
format, e.g.Intro to HTML and CSS lesson: Fix link text
Because
section summarizes the reason for this PRThis PR
section has a bullet point list describing the changes in this PRIssue
section