Closed jeromedalbert closed 2 months ago
@jeromedalbert add a Changelog entry, please
@MatheusRich This project does not seem to have a Changelog file. 😅
After looking at this:
https://github.com/rails/jbuilder/blob/acf44b86eebeb229dea651f2a8ec4bdd64a5328c/jbuilder.gemspec#L26
It looks like changelogs are made directly from GitHub at release time: https://github.com/rails/jbuilder/releases
So I guess I'm good on my end, but let me know if I missed something.
Problem
PR https://github.com/rails/rails/pull/51674 updated controller generator templates in the Rails codebase. But, as DHH explained, we need to do the same update to templates in jbuilder, because they are used by default for new Rails apps.
Solution
Port the changes from https://github.com/rails/rails/pull/51674 to this codebase, only for Rails versions 8.0+:
Change templates to use
params.expect(post: [ :title, ... ])
instead ofparams.require(:post).permit(:title, ...)
.Notice the spaces around
[
and]
in order to be compliant withrubocop-rails-omakase
rules, which are enabled by default for new Rails apps.@post = params.expect(:id)
instead of@post = params[:id]
.cc @martinemde