Skip to content

Commit 4fc2d9d

Browse files
authored
Merge pull request #355 from rails/rm-rails-8.1
Upgrade application config to 8.1
2 parents 8c125f8 + 5e0a730 commit 4fc2d9d

File tree

11 files changed

+217
-29
lines changed

11 files changed

+217
-29
lines changed

bin/setup

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ FileUtils.chdir APP_ROOT do
2222

2323
puts "\n== Preparing database =="
2424
system! "bin/rails db:prepare"
25+
system! "bin/rails db:reset" if ARGV.include?("--reset")
2526

2627
puts "\n== Removing old logs and tempfiles =="
2728
system! "bin/rails log:clear tmp:clear"

config/environments/development.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
# Append comments with runtime information tags to SQL queries in logs.
4141
config.active_record.query_log_tags_enabled = true
4242

43+
# Highlight code that triggered redirect in logs.
44+
config.action_dispatch.verbose_redirect_logs = true
45+
4346
# Debug mode disables concatenation and preprocessing of assets.
4447
# This option may cause significant delays in view rendering with a large
4548
# number of complex assets.

config/environments/production.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
config.log_tags = [ :request_id ]
3939
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
4040

41-
# Change to "debug" to log everything (including potentially personally-identifiable information!)
41+
# Change to "debug" to log everything (including potentially personally-identifiable information!).
4242
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
4343

4444
# Prevent health checks from clogging up the logs.

config/initializers/content_security_policy.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
2121
# config.content_security_policy_nonce_directives = %w(script-src style-src)
2222
#
23+
# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
24+
# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
25+
# # config.content_security_policy_nonce_auto = true
26+
#
2327
# # Report violations without enforcing the policy.
2428
# # config.content_security_policy_report_only = true
2529
# end
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Be sure to restart your server when you modify this file.
2+
#
3+
# This file eases your Rails 8.1 framework defaults upgrade.
4+
#
5+
# Uncomment each configuration one by one to switch to the new default.
6+
# Once your application is ready to run with all new defaults, you can remove
7+
# this file and set the `config.load_defaults` to `8.1`.
8+
#
9+
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
10+
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11+
12+
###
13+
# Skips escaping HTML entities and line separators. When set to `false`, the
14+
# JSON renderer no longer escapes these to improve performance.
15+
#
16+
# Example:
17+
# class PostsController < ApplicationController
18+
# def index
19+
# render json: { key: "\u2028\u2029<>&" }
20+
# end
21+
# end
22+
#
23+
# Renders `{"key":"\u2028\u2029\u003c\u003e\u0026"}` with the previous default, but `{"key":"

<>&"}` with the config
24+
# set to `false`.
25+
#
26+
# Applications that want to keep the escaping behavior can set the config to `true`.
27+
#++
28+
# Rails.configuration.action_controller.escape_json_responses = false
29+
30+
###
31+
# Skips escaping LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) in JSON.
32+
#
33+
# Historically these characters were not valid inside JavaScript literal strings but that changed in ECMAScript 2019.
34+
# As such it's no longer a concern in modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset.
35+
#++
36+
# Rails.configuration.active_support.escape_js_separators_in_json = false
37+
38+
###
39+
# Raises an error when order dependent finder methods (e.g. `#first`, `#second`) are called without `order` values
40+
# on the relation, and the model does not have any order columns (`implicit_order_column`, `query_constraints`, or
41+
# `primary_key`) to fall back on.
42+
#
43+
# The current behavior of not raising an error has been deprecated, and this configuration option will be removed in
44+
# Rails 8.2.
45+
#++
46+
# Rails.configuration.active_record.raise_on_missing_required_finder_order_columns = true
47+
48+
###
49+
# Controls how Rails handles path relative URL redirects.
50+
# When set to `:raise`, Rails will raise an `ActionController::Redirecting::UnsafeRedirectError`
51+
# for relative URLs without a leading slash, which can help prevent open redirect vulnerabilities.
52+
#
53+
# Example:
54+
# redirect_to "example.com" # Raises UnsafeRedirectError
55+
# redirect_to "@attacker.com" # Raises UnsafeRedirectError
56+
# redirect_to "/safe/path" # Works correctly
57+
#
58+
# Applications that want to allow these redirects can set the config to `:log` (previous default)
59+
# to only log warnings, or `:notify` to send ActiveSupport notifications.
60+
#++
61+
# Rails.configuration.action_controller.action_on_path_relative_redirect = :raise
62+
63+
###
64+
# Use a Ruby parser to track dependencies between Action View templates
65+
#++
66+
# Rails.configuration.action_view.render_tracker = :ruby
67+
68+
###
69+
# When enabled, hidden inputs generated by `form_tag`, `token_tag`, `method_tag`, and the hidden parameter fields
70+
# included in `button_to` forms will omit the `autocomplete="off"` attribute.
71+
#
72+
# Applications that want to keep generating the `autocomplete` attribute for those tags can set it to `false`.
73+
#++
74+
# Rails.configuration.action_view.remove_hidden_field_autocomplete = true

config/puma.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
#
88
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
99
# should only set this value when you want to run 2 or more workers. The
10-
# default is already 1.
10+
# default is already 1. You can set it to `auto` to automatically start a worker
11+
# for each available processor.
1112
#
1213
# The ideal number of threads per worker depends both on how much time the
1314
# application spends waiting for IO operations and on how much you wish to
@@ -33,7 +34,7 @@
3334
# Allow puma to be restarted by `bin/rails restart` command.
3435
plugin :tmp_restart
3536

36-
# Run the Solid Queue supervisor inside of Puma for single-server deployments
37+
# Run the Solid Queue supervisor inside of Puma for single-server deployments.
3738
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
3839

3940
# Specify the PID file. Defaults to tmp/pids/server.pid in development.

public/400.html

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,35 @@
3535
font-weight: 400;
3636
letter-spacing: -0.0025em;
3737
line-height: 1.4;
38-
min-height: 100vh;
38+
min-height: 100dvh;
3939
place-items: center;
4040
text-rendering: optimizeLegibility;
4141
-webkit-text-size-adjust: 100%;
4242
}
4343

44+
#error-description {
45+
fill: #d30001;
46+
}
47+
48+
#error-id {
49+
fill: #f0eff0;
50+
}
51+
52+
@media (prefers-color-scheme: dark) {
53+
body {
54+
background: #101010;
55+
color: #e0e0e0;
56+
}
57+
58+
#error-description {
59+
fill: #FF6161;
60+
}
61+
62+
#error-id {
63+
fill: #2c2c2c;
64+
}
65+
}
66+
4467
a {
4568
color: inherit;
4669
font-weight: 700;
@@ -83,13 +106,11 @@
83106
}
84107

85108
main article br {
86-
87109
display: none;
88110

89111
@media(min-width: 48em) {
90112
display: inline;
91113
}
92-
93114
}
94115

95116
</style>
@@ -102,10 +123,10 @@
102123

103124
<main>
104125
<header>
105-
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" fill="#f0eff0"/><path d="m123.606 85.4445c3.212 1.0523 5.538 4.2089 5.538 8.0301 0 6.1472-4.209 9.5254-11.298 9.5254h-15.617v-34.0033h14.565c7.089 0 11.353 3.1566 11.353 9.2484 0 3.6551-2.049 6.3134-4.541 7.1994zm-12.904-2.9905h5.095c2.603 0 3.988-.9968 3.988-3.1013 0-2.1044-1.385-3.0459-3.988-3.0459h-5.095zm0 6.6456v6.5902h5.981c2.492 0 3.877-1.3291 3.877-3.2674 0-2.049-1.385-3.3228-3.877-3.3228zm43.786 13.9004h-8.362v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.083-2.769-9.083-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.483 1.3845v-1.606c0-1.606-.942-2.9905-3.046-2.9905-1.606 0-2.548.7199-2.935 1.8275h-8.197c.72-4.8181 4.985-8.6393 11.409-8.6393 7.088 0 11.131 3.7659 11.131 10.2453zm-8.362-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm27.996 6.9779v-1.994c-1.163 1.329-3.599 2.548-6.147 2.548-7.199 0-11.131-5.8151-11.131-13.0145s3.932-13.0143 11.131-13.0143c2.548 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.664-1.3291-2.159-2.326-3.821-2.326-2.99 0-4.763 2.4368-4.763 5.6488s1.773 5.5934 4.763 5.5934c1.717 0 3.157-.9415 3.821-2.326zm35.471-2.049h-3.101v11.2421h-8.806v-34.0033h15.285c7.31 0 12.35 4.1535 12.35 11.5744 0 5.1503-2.603 8.6947-6.757 10.2453l7.975 12.1836h-9.858zm-3.101-15.2849v8.1962h5.538c3.156 0 4.596-1.606 4.596-4.0981s-1.44-4.0981-4.596-4.0981zm36.957 17.8323h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm30.98 27.5234v-10.799c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.9259-11.132-13.0145 0-7.144 3.932-13.0143 11.132-13.0143 2.547 0 4.984 1.2184 6.147 2.5475v-1.9937h8.695v33.726zm0-17.9981v-6.5902c-.665-1.3291-2.105-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.661 0 3.156-.9415 3.821-2.326zm36.789-15.7279v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.996 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm19.084 16.2263h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.963 5.095 11.963 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm13.428 11.0206h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.762-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm27.538-.8861v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.993-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.871 0-9.193-2.769-9.193-9.0819z" fill="#d30001"/></svg>
126+
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" id="error-id"/><path d="m123.606 85.4445c3.212 1.0523 5.538 4.2089 5.538 8.0301 0 6.1472-4.209 9.5254-11.298 9.5254h-15.617v-34.0033h14.565c7.089 0 11.353 3.1566 11.353 9.2484 0 3.6551-2.049 6.3134-4.541 7.1994zm-12.904-2.9905h5.095c2.603 0 3.988-.9968 3.988-3.1013 0-2.1044-1.385-3.0459-3.988-3.0459h-5.095zm0 6.6456v6.5902h5.981c2.492 0 3.877-1.3291 3.877-3.2674 0-2.049-1.385-3.3228-3.877-3.3228zm43.786 13.9004h-8.362v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.083-2.769-9.083-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.483 1.3845v-1.606c0-1.606-.942-2.9905-3.046-2.9905-1.606 0-2.548.7199-2.935 1.8275h-8.197c.72-4.8181 4.985-8.6393 11.409-8.6393 7.088 0 11.131 3.7659 11.131 10.2453zm-8.362-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm27.996 6.9779v-1.994c-1.163 1.329-3.599 2.548-6.147 2.548-7.199 0-11.131-5.8151-11.131-13.0145s3.932-13.0143 11.131-13.0143c2.548 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.664-1.3291-2.159-2.326-3.821-2.326-2.99 0-4.763 2.4368-4.763 5.6488s1.773 5.5934 4.763 5.5934c1.717 0 3.157-.9415 3.821-2.326zm35.471-2.049h-3.101v11.2421h-8.806v-34.0033h15.285c7.31 0 12.35 4.1535 12.35 11.5744 0 5.1503-2.603 8.6947-6.757 10.2453l7.975 12.1836h-9.858zm-3.101-15.2849v8.1962h5.538c3.156 0 4.596-1.606 4.596-4.0981s-1.44-4.0981-4.596-4.0981zm36.957 17.8323h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm30.98 27.5234v-10.799c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.9259-11.132-13.0145 0-7.144 3.932-13.0143 11.132-13.0143 2.547 0 4.984 1.2184 6.147 2.5475v-1.9937h8.695v33.726zm0-17.9981v-6.5902c-.665-1.3291-2.105-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.661 0 3.156-.9415 3.821-2.326zm36.789-15.7279v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.996 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm19.084 16.2263h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.963 5.095 11.963 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm13.428 11.0206h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.762-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm27.538-.8861v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.993-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.871 0-9.193-2.769-9.193-9.0819z" id="error-description"/></svg>
106127
</header>
107128
<article>
108-
<p><strong>The server cannot process the request due to a client error.</strong> Please check the request and try again. If youre the application owner check the logs for more information.</p>
129+
<p><strong>The server cannot process the request due to a client error.</strong> Please check the request and try again. If you're the application owner check the logs for more information.</p>
109130
</article>
110131
</main>
111132

0 commit comments

Comments
 (0)