Skip to content
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

Rails Course: Update strong params to use new Rails 8 method #29127

Merged
merged 6 commits into from
Dec 3, 2024

Conversation

JoshDevHub
Copy link
Contributor

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

  • Updates controllers lesson to use the new #expect syntax.
  • Mentions the permit().require() chain as an older alternative that learners may run into.
  • Updates other examples of strong parameters throughout the Rails course to use the newer syntax.
  • Fixes lint issues in the controllers lesson.
  • Introduces small clarification on what exactly params is inside of a controller.

Issue

Closes #29121

Additional Information

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@github-actions github-actions bot added the Content: Ruby on Rails Involves the Ruby on Rails course label Nov 25, 2024
Copy link
Member

@KevinMulhern KevinMulhern left a comment

Choose a reason for hiding this comment

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

🔥 great stuff @JoshDevHub!

@JoshDevHub JoshDevHub merged commit cf86711 into TheOdinProject:main Dec 3, 2024
3 of 4 checks passed
@JoshDevHub JoshDevHub deleted the strong_params_rails_8 branch December 3, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: Ruby on Rails Involves the Ruby on Rails course
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Controllers: Rails 8 docs conflicts with the current lesson (based on Rails 7)
2 participants