Rails recently merged a new API to deal with params. Instead of the common pattern params.require(:user).permit(:name, :age)
now we should write params.expect(user: [:name, :age])
.
This is not only shorter but also better deals with param tampering. For example, the following /path?user=string
would break with require+permit
but not with expect
.
[#]ruby
=> More informations about this toot | More toots from matheusrich@mastodon.social
Here's the PR: https://github.com/rails/rails/pull/51674
=> More informations about this toot | More toots from matheusrich@mastodon.social This content has been proxied by September (3851b).Proxy Information
text/gemini