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

Upgrade app configuration to Rails 7.1 #3500

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

unoduetre
Copy link
Contributor

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

What

We need to upgrade our apps to the latest version of Rails.

How

Follow these steps: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#moving-between-versions

Trello ticket

@govuk-ci govuk-ci temporarily deployed to collections-pr-3500 January 12, 2024 13:34 Inactive
@unoduetre unoduetre changed the title Upgrade Rails configuraion to Rails version 7.1 Upgrade Rails configuration to Rails version 7.1 Jan 12, 2024
@unoduetre unoduetre changed the title Upgrade Rails configuration to Rails version 7.1 Upgrade configuration to Rails version 7.1 Jan 12, 2024
Copy link
Contributor Author

@unoduetre unoduetre left a comment

Choose a reason for hiding this comment

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

Commented below.

@@ -5,7 +5,7 @@ require "fileutils"
APP_ROOT = File.expand_path("..", __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
system(*args, exception: true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change made by Rails

@@ -1,4 +1,4 @@
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup"
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comment is from Rails.

@@ -6,7 +6,7 @@
# In the development environment your application's code is reloaded any time
# 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
Contributor Author

@unoduetre unoduetre Jan 12, 2024

Choose a reason for hiding this comment

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

Rails changed the name of this option and reversed it, so enable_reloading=!cache_classes

@@ -47,6 +47,9 @@
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []

# Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added by Rails.

@@ -56,6 +59,9 @@
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true

# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added by Rails.

logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Enable DNS rebinding protection and other `Host` header attacks.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added by Rails, commented by default.

@@ -8,8 +8,8 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Turn false under Spring and add config.action_view.cache_template_loading = true.
config.cache_classes = true
# While tests run files are not watched, reloading is not necessary.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above.

@@ -27,8 +27,8 @@
config.action_controller.perform_caching = false
config.cache_store = :null_store

# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Render exception templates for rescuable exceptions and raise for other exceptions.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New Rails default for the test environment.

# f.usb :none
# f.fullscreen :self
# f.payment :self, "https://secure.example.com"
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change by Rails.

@@ -54,4 +54,7 @@

# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true

# Raise error when a before_action's only/except options reference missing actions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above.

Autoloaded paths are no longer in $LOAD_PATH.
The file services.rb is in app/lib which is autoloaded.
@govuk-ci govuk-ci temporarily deployed to collections-pr-3500 January 12, 2024 15:07 Inactive
@unoduetre unoduetre marked this pull request as ready for review January 12, 2024 15:09
@unoduetre unoduetre changed the title Upgrade configuration to Rails version 7.1 Upgrade app configuration to Rails 7.1 Jan 12, 2024
@unoduetre unoduetre requested a review from hannako January 12, 2024 15:27
@Tetrino Tetrino merged commit 1b4a71c into main Jan 15, 2024
15 checks passed
@Tetrino Tetrino deleted the 2307-upgrade-our-apps-to-rails-712 branch January 15, 2024 10:38
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.

3 participants