Skip to content

Bump Rails from 7.1.x to 7.2.x#840

Merged
jefferya merged 12 commits intomainfrom
jefferya/rails_7.2
Oct 30, 2025
Merged

Bump Rails from 7.1.x to 7.2.x#840
jefferya merged 12 commits intomainfrom
jefferya/rails_7.2

Conversation

@jefferya
Copy link
Copy Markdown
Contributor

@jefferya jefferya commented Aug 14, 2025

@jefferya
Copy link
Copy Markdown
Contributor Author

jefferya commented Aug 15, 2025

A quick set of todos before I transition to my other position mid August.

:

@jefferya jefferya mentioned this pull request Aug 15, 2025
@jefferya jefferya changed the title [WIP] Bump Rails from 7.1.x to 7.2.x Bump Rails from 7.1.x to 7.2.x Oct 7, 2025
@jefferya
Copy link
Copy Markdown
Contributor Author

jefferya commented Oct 7, 2025

Test successful. Needs to be merged with #845, once approved. Merging involves accepting the merge conflicts from the introduction of the Config Gem.

* rubocop-capybara, rubocop-minitest, rubocop-performance, and rubocop-rails extension supports the new plugin system in rubocop 1.72
* site loads enabling: config/initializers/new_framework_defaults_7_2.rb:
* adds to workaround current Rails 7.2 incompatibility in restarone/comfortable-mexican-sofa: Rails.application.config.active_record.default_column_serializer = YAML
* After running bin/rails app:update, staging.rb not changed therefore align with updated production.rb while retaining staging/production differences.
@jefferya jefferya force-pushed the jefferya/rails_7.2 branch from 66d8b1b to e36db20 Compare October 7, 2025 18:42
Comment on lines +49 to +56
- name: Read Node version from .tool-versions
id: node_version
run: |
echo "node_version=$(grep nodejs .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT

- uses: actions/setup-node@v5
with:
node-version: 18
node-version: ${{ steps.node_version.outputs.node_version }}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Inconsistency between ./tool-versions and what is defined in the GitHub action. This change aligns the two.

Comment on lines +2 to 8
- standard
plugins:
- rubocop-capybara
- rubocop-minitest
- rubocop-performance
- rubocop-rails
- standard

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Silence a warning while running rubocop. rubocop-capybara, rubocop-minitest, rubocop-performance, and rubocop-rails extension supports the new plugin system in rubocop 1.72.

require "bundler/setup"

# explicit rubocop config increases performance slightly while avoiding config confusion.
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

bin/rails app:update suggestion.

# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
config.enable_reloading = true
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Rails 7.2: can omit cache_classes = false because it's now implied when enable_reloading = true. Suggestion by bin/rails app:update.

Comment on lines +51 to +55
# Rails.application.config.active_record.default_column_serializer = nil
# comfortable_mexican_sofa v3.5 https://github.com/restarone/comfortable-mexican-sofa.git
# not updated for Rails 7.1 to specify serialization method for the
# Comfy::Cms::Fragment and Comfy::Cms::Revision models
Rails.application.config.active_record.default_column_serializer = YAML
Copy link
Copy Markdown
Contributor Author

@jefferya jefferya Oct 7, 2025

Choose a reason for hiding this comment

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

Flagging as a non-default setting due to lack of maintenance on the current fork of comfortable_mexican_sofa. YAML needs to be specifed or comfortable_mexican_sofa patched to specify a serialization method for Comfy::Cms::Fragment and Comfy::Cms::Revision models.

Comment on lines +61 to 64
config.logger = ActiveSupport::Logger.new($stdout)
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

bin/rails app:update suggestion. The previous config.logger definition aligned with Jupiter and/or the default Rails generated version of this file. The rest of this file aligns with bin/rails app:update suggestions with past customizations layered ontop. Similar with other config/environments/{environment}.rb files.

Comment on lines +29 to +40
threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
threads threads_count, threads_count

# Allow puma to be restarted by `rails restart` command.
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
port ENV.fetch("PORT", 3000)

# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart

# Specify the PID file. Defaults to tmp/pids/server.pid in development.
# In other environments, only set the PID file if requested.
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

bin/rails app:update suggested text and reordering. I reordered to hopefully make the next Rails update easier. The pidfile setting was added by bin/rails app:update. I'm not sure if needed.

@jefferya
Copy link
Copy Markdown
Contributor Author

jefferya commented Oct 7, 2025

404.html, 406-unsupported-browser.html, 422.html, 500.html, icon.png, and icon.svg were added by the bin/rails app:update. Should these be kept?

jefferya and others added 2 commits October 8, 2025 11:31
…refore downgrade rack to 3.1.17 with security fixes. Fixes merge from main causing build failures
Comment on lines -53 to +47
rack (>= 2.2.4)
rack (>= 2.2.4, < 3.2)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Notice the refined version set on actionpack for rack. This requires the downgrade of rack from 3.2.2 to 3.1.17 later on in Gemfile.lock. Both remain supported: https://github.com/rack/rack?tab=readme-ov-file#version-supported. Impact seems unnoticable.

Copy link
Copy Markdown
Member

@pgwillia pgwillia left a comment

Choose a reason for hiding this comment

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

Just the comment about the potential duplication of error messages. Is there work to do there?

public/404.html Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't see why we have this, but there's routes, an ErrorController and views in our code

match "/404", to: "errors#file_not_found", via: :all
match "/422", to: "errors#unprocessable", via: :all
match "/500", to: "errors#internal_server_error", via: :all

https://github.com/ualbertalib/library-cms/tree/main/app/views/errors
Does this replace that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I accidentally deleted my commit on this while untangling the dependency problems. Yes, I need to redo work from 3 weeks ago.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for flagging this. Looks better now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just for my understanding... Are we handling errors in a non-standard way?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did my research. It's a standard way of having custom error pages

https://guides.rubyonrails.org/configuring.html#config-exceptions-app

config.exceptions_app = routes

There are many blogs describing this approach. Here's one from 2024 https://www.dotruby.com/articles/how-to-create-a-custom-error-page-in-rails

Copy link
Copy Markdown
Member

@pgwillia pgwillia left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍

public/404.html Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did my research. It's a standard way of having custom error pages

https://guides.rubyonrails.org/configuring.html#config-exceptions-app

config.exceptions_app = routes

There are many blogs describing this approach. Here's one from 2024 https://www.dotruby.com/articles/how-to-create-a-custom-error-page-in-rails

@jefferya jefferya merged commit d34aed4 into main Oct 30, 2025
2 checks passed
@jefferya jefferya deleted the jefferya/rails_7.2 branch October 30, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants