Skip to content

Commit

Permalink
Enable Rails 7.2 defaults flag
Browse files Browse the repository at this point in the history
Also enables autoloading for the lib directory which is now enforced in
Zeitwerk and effective in Rails 7.2.
  • Loading branch information
Tetrino committed Dec 4, 2024
1 parent 04ad0e6 commit 9b55d0f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 0 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.1)
logger (1.6.1)
logstasher (2.1.5)
activesupport (>= 5.2)
request_store
Expand Down
18 changes: 17 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ class Application < Rails::Application
include GovukPublishingComponents::AppHelpers::AssetHelper

# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.load_defaults 7.2
config.govuk_time_zone = "London"

Rails.application.config.action_view.form_with_generates_remote_forms = false
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W[#{config.root}/lib #{config.root}/app/presenters]

# New for rails 7.1 to enable previous autoload behaviour
config.add_autoload_paths_to_load_path = true

# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
Expand All @@ -37,6 +44,7 @@ class Application < Rails::Application
config.i18n.enforce_available_locales = false
config.i18n.default_locale = :"en-GB"
config.i18n.fallbacks = true
config.i18n.load_path += Dir[Rails.root.join("config/locales/**/*.yml")]

# Path within public/ where assets are compiled to
config.assets.prefix = "/assets/smartanswers"
Expand All @@ -49,7 +57,15 @@ class Application < Rails::Application

# Version of your assets, change this if you want to expire all your assets
config.assets.version = "1.0"

# Disable Rack::Cache
config.action_dispatch.rack_cache = nil

config.action_dispatch.ignore_accept_header = true

# Force lib autoload, which was removed by Rails 3.0 and enforced by Zeitwerk
config.eager_load_paths << Rails.root.join("lib")

# Allow requests for all domains e.g. <app>.dev.gov.uk
config.hosts.clear
# Please, add to the `ignore` list any other `lib` subdirectories that do
Expand Down

0 comments on commit 9b55d0f

Please sign in to comment.