Skip to content

Use Rails 7.2 defaults#799

Merged
zetter-rpf merged 5 commits intomainfrom
7_2_defaults
Apr 29, 2026
Merged

Use Rails 7.2 defaults#799
zetter-rpf merged 5 commits intomainfrom
7_2_defaults

Conversation

@zetter-rpf
Copy link
Copy Markdown
Contributor

@zetter-rpf zetter-rpf commented Apr 29, 2026

Split out of #784

You can see new settings at [1], they all seem safe for us to switch to.

This is in preparation for upgrading to Rails 8 and later using those defaults.

I'll monitor RAM usage in Heroku after deploying because of the YJIT change.

[1] https://redirect.github.com/rails/rails/blob/v7.2.3.1/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt

You can see new settings at [1], they all seem safe for us to switch to.

I'll monitor RAM usage in Heroku after deploying because of the YJIT change.

[1] https://redirect.github.com/rails/rails/blob/v7.2.3.1/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt
This was suggested by the rails upgrade tool
@cla-bot cla-bot Bot added the cla-signed label Apr 29, 2026
@zetter-rpf zetter-rpf marked this pull request as ready for review April 29, 2026 11:00
Copilot AI review requested due to automatic review settings April 29, 2026 11:00
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

Test coverage

89.73% line coverage reported by SimpleCov.
Run: https://github.com/RaspberryPiFoundation/editor-api/actions/runs/25112662480

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the app to opt into Rails 7.2 framework defaults (as prep work for the Rails 8 upgrade) and adds a RuboCop binstub to run RuboCop with an explicit config file.

Changes:

  • Switch config.load_defaults from 7.1 to 7.2.
  • Add bin/rubocop wrapper to run RuboCop using the repo’s .rubocop.yml.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
config/application.rb Opts the app into Rails 7.2 default configuration behavior.
bin/rubocop Adds a RuboCop binstub that forces use of the repository config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/application.rb Outdated
Comment thread config/application.rb
@zetter-rpf zetter-rpf requested a review from abcampo-iry April 29, 2026 11:16
This was confusing as the logger was configured twice in this file.

Previous versions of rails didn't log to STDOUT in prod by default, they do now so we can remove this and the log_formatter setting.

The formatter is also not used if the logger is set [1]

[1] https://guides.rubyonrails.org/configuring.html#config-log-formatter
Copy link
Copy Markdown
Contributor

@abcampo-iry abcampo-iry left a comment

Choose a reason for hiding this comment

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

I just checked, we have in Gemfile:
gem 'rails', '~> 7.1'
and in Lockfile
7.2.3.1

maybe we want to make it explicit, in the upgrade by adding in Gemfile:
gem 'rails', '~> 7.2'

(although we are effecitvely in that version)

otherwise good, thanks

@zetter-rpf zetter-rpf merged commit 6d9b9f6 into main Apr 29, 2026
5 checks passed
@zetter-rpf zetter-rpf deleted the 7_2_defaults branch April 29, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants