From d74cfc19f4a1e6889815c8f4649e9701433ca666 Mon Sep 17 00:00:00 2001 From: Martin Emde Date: Sun, 1 Dec 2024 13:32:59 -0800 Subject: [PATCH] rails app:update and reconcile differences manually --- config/environments/development.rb | 7 +++-- config/environments/production.rb | 28 ++++++++--------- config/environments/test.rb | 8 ++--- .../new_framework_defaults_8_0.rb | 30 +++++++++++++++++++ config/puma.rb | 3 ++ public/400.html | 21 +++++++++++++ public/403.html | 2 +- public/406-unsupported-browser.html | 21 +++++++++++++ 8 files changed, 97 insertions(+), 23 deletions(-) create mode 100644 config/initializers/new_framework_defaults_8_0.rb create mode 100644 public/400.html create mode 100644 public/406-unsupported-browser.html diff --git a/config/environments/development.rb b/config/environments/development.rb index 2384e1ee68d..b053a1c3781 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -17,8 +17,8 @@ # Enable server timing. config.server_timing = true - # Enable/disable caching. By default caching is disabled. - # Run rails dev:cache to toggle caching. + # Enable/disable Action Controller caching. By default Action Controller caching is disabled. + # Run rails dev:cache to toggle Action Controller caching. if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true @@ -60,6 +60,9 @@ # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true + # Append comments with runtime information tags to SQL queries in logs. + config.active_record.query_log_tags_enabled = true + # Highlight code that enqueued background job in logs. config.active_job.verbose_enqueue_logs = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 8d95758ee47..8fe9fec906a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -6,14 +6,13 @@ # Code is not reloaded between requests. config.enable_reloading = false - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks). config.eager_load = true - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false + # Full error reports are disabled. + config.consider_all_requests_local = false + + # Turn on fragment caching in view templates. config.action_controller.perform_caching = true # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment @@ -66,7 +65,10 @@ # want to log everything, set the level to "debug". config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") - # Use a different cache store in production. + # Don't log any deprecations. + config.active_support.report_deprecations = false + + # Replace the default in-process memory cache store with a durable alternative. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment). @@ -90,18 +92,12 @@ # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Log disallowed deprecations. - config.active_support.disallowed_deprecation = :log - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + # Only use :id for inspections in production. + config.active_record.attributes_for_inspect = [ :id ] + # Enable DNS rebinding protection and other `Host` header attacks. # config.hosts = [ # "example.com", # Allow requests from example.com diff --git a/config/environments/test.rb b/config/environments/test.rb index a65ac8280f1..f23e7bde4ec 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -23,13 +23,13 @@ "Cache-Control" => "public, max-age=#{1.hour.to_i}" } - # Show full error reports and disable caching. - config.consider_all_requests_local = true + # Show full error reports. + config.consider_all_requests_local = true config.action_controller.perform_caching = false config.cache_store = :mem_cache_store - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = :none + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false diff --git a/config/initializers/new_framework_defaults_8_0.rb b/config/initializers/new_framework_defaults_8_0.rb new file mode 100644 index 00000000000..92efa951524 --- /dev/null +++ b/config/initializers/new_framework_defaults_8_0.rb @@ -0,0 +1,30 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 8.0 framework defaults upgrade. +# +# Uncomment each configuration one by one to switch to the new default. +# Once your application is ready to run with all new defaults, you can remove +# this file and set the `config.load_defaults` to `8.0`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +### +# Specifies whether `to_time` methods preserve the UTC offset of their receivers or preserves the timezone. +# If set to `:zone`, `to_time` methods will use the timezone of their receivers. +# If set to `:offset`, `to_time` methods will use the UTC offset. +# If `false`, `to_time` methods will convert to the local system UTC offset instead. +#++ +# Rails.application.config.active_support.to_time_preserves_timezone = :zone + +### +# When both `If-Modified-Since` and `If-None-Match` are provided by the client +# only consider `If-None-Match` as specified by RFC 7232 Section 6. +# If set to `false` both conditions need to be satisfied. +#++ +# Rails.application.config.action_dispatch.strict_freshness = true + +### +# Set `Regexp.timeout` to `1`s by default to improve security over Regexp Denial-of-Service attacks. +#++ +# Regexp.timeout = 1 diff --git a/config/puma.rb b/config/puma.rb index 06bcbfdb6d8..d26a113096b 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -48,6 +48,9 @@ # 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 + # Specifies the `environment` that Puma will run in. environment rails_env diff --git a/public/400.html b/public/400.html new file mode 100644 index 00000000000..c2429c9a983 --- /dev/null +++ b/public/400.html @@ -0,0 +1,21 @@ + + + + + + + Client Error | RubyGems.org + + +
+
+ 400 error +
+
+

Client Error

+

Please check the request and try again.

+ Back to RubyGems.org → +
+
+ + diff --git a/public/403.html b/public/403.html index 4c6bb6bc39b..880f163855a 100644 --- a/public/403.html +++ b/public/403.html @@ -9,7 +9,7 @@
- 422 error + 403 error

Forbidden.

diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html new file mode 100644 index 00000000000..be957625ecb --- /dev/null +++ b/public/406-unsupported-browser.html @@ -0,0 +1,21 @@ + + + + + + + Browser Not Supported | RubyGems.org + + +
+
+ 403 error +
+
+

Browser Not Supported

+

Please upgrade your browser to continue.

+ Back to RubyGems.org → +
+
+ +