railties 7.1.1 → 7.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef62f9bd93d210f9dab067b6c425e87856270615f9416e347c74d833453096b2
4
- data.tar.gz: f405f87214572e3e77d2c6916342dafd8809a6e956518040adb57938ea2d9e19
3
+ metadata.gz: 2eaeb12aa4c0fb4003d5caa465f16d95ed6e3b273b9cbd7416ec9197fcfafbe1
4
+ data.tar.gz: 6d4060833d16239706518d1486c2fc80908292a9c2e9e9f16e7c2110d6b40e30
5
5
  SHA512:
6
- metadata.gz: ac990f46b016fbc43c559511596e6c6e84a911dd1d5ae3cee65746cefd9f84691979e55f02c5d0a50da4d55720b44d72609db3da6fe9d507927d64a7030a6c5a
7
- data.tar.gz: f8bf05ced8bfdc32dd941eaac774b9daa70878480d9c3331b02450c4bd5aa4f1cc98c9cba5840a11f2c0e3c2880c822b045bb5f751992ac5eaf461c333f33f07
6
+ metadata.gz: 04f4eeedc7a35ea369cc617225e6029e87ed1f471e2f1212a62b00e6de75418b81050e7eec0f209deeb6a8b6fb2cd0b1820fcf3c379bd63c26c3bdeff4d42353
7
+ data.tar.gz: 06e0ad10659ce5fbde4af09fe583accd6d8dba8c792b8fa2024871d28c513eeada26af15e70a97f4599685bf910c1a958e99470d0073166bbce4e85ee17c1b60
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## Rails 7.1.2 (November 10, 2023) ##
2
+
3
+ * Fix running `db:system:change` when app has no Dockerfile.
4
+
5
+ *Hartley McGuire*
6
+
7
+ * If you accessed `config.eager_load_paths` and friends, later changes to
8
+ `config.paths` were not reflected in the expected auto/eager load paths.
9
+ Now, they are.
10
+
11
+ This bug has been latent since Rails 3.
12
+
13
+ Fixes #49629.
14
+
15
+ *Xavier Noria*
16
+
1
17
  ## Rails 7.1.1 (October 11, 2023) ##
2
18
 
3
19
  * Ensures the Rails generated Dockerfile uses correct ruby version and matches Gemfile.
@@ -54,9 +54,9 @@ module Rails
54
54
  )
55
55
  logger
56
56
  end
57
- Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
58
57
 
59
58
  unless Rails.logger.is_a?(ActiveSupport::BroadcastLogger)
59
+ Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
60
60
  broadcast_logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
61
61
  broadcast_logger.formatter = Rails.logger.formatter
62
62
  Rails.logger = broadcast_logger
@@ -477,7 +477,21 @@ module Rails
477
477
  config.secret_key_base ||= generate_local_secret
478
478
  else
479
479
  validate_secret_key_base(
480
- ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base
480
+ ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || begin
481
+ secret_skb = secrets_secret_key_base
482
+
483
+ if secret_skb.equal?(config.secret_key_base)
484
+ config.secret_key_base
485
+ else
486
+ Rails.deprecator.warn(<<~MSG.squish)
487
+ Your `secret_key_base is configured in `Rails.application.secrets`,
488
+ which is deprecated in favor of `Rails.application.credentials` and
489
+ will be removed in Rails 7.2.
490
+ MSG
491
+
492
+ secret_skb
493
+ end
494
+ end
481
495
  )
482
496
  end
483
497
  end
@@ -26,7 +26,7 @@ Setup:
26
26
  is easier to manage. You could set `RAILS_MASTER_KEY` in a deployment
27
27
  configuration, or you could prepend it to your server's start command like so:
28
28
 
29
- RAILS_MASTER_KEY="very-secret-and-secure" server.start
29
+ RAILS_MASTER_KEY="very-secret-and-secure" bin/rails server
30
30
 
31
31
  If `ENV["RAILS_MASTER_KEY"]` is present, it takes precedence over
32
32
  `config/master.key`.
@@ -27,7 +27,7 @@ Setup:
27
27
 
28
28
  You could prepend that to your server's start command like this:
29
29
 
30
- RAILS_MASTER_KEY="im-the-master-now-hahaha" server.start
30
+ RAILS_MASTER_KEY="im-the-master-now-hahaha" bin/rails server
31
31
 
32
32
  The `config/secrets.yml.enc` has much the same format as `config/secrets.yml`:
33
33
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support"
4
+ require "active_support/core_ext/string/filters"
4
5
  require "rails/secrets"
5
6
  require "rails/command/helpers/editor"
6
7
 
@@ -9,12 +9,45 @@ module Rails
9
9
  attr_accessor :middleware, :javascript_path
10
10
  attr_writer :eager_load_paths, :autoload_once_paths, :autoload_paths
11
11
 
12
+ # An array of custom autoload paths to be added to the ones defined
13
+ # automatically by Rails. These won't be eager loaded, unless you push
14
+ # them to +eager_load_paths+ too, which is recommended.
15
+ #
16
+ # This collection is empty by default, it accepts strings and +Pathname+
17
+ # objects.
18
+ #
19
+ # If you'd like to add +lib+ to it, please see +autoload_lib+.
20
+ attr_reader :autoload_paths
21
+
22
+ # An array of custom autoload once paths. These won't be eager loaded
23
+ # unless you push them to +eager_load_paths+ too, which is recommended.
24
+ #
25
+ # This collection is empty by default, it accepts strings and +Pathname+
26
+ # objects.
27
+ #
28
+ # If you'd like to add +lib+ to it, please see +autoload_lib_once+.
29
+ attr_reader :autoload_once_paths
30
+
31
+ # An array of custom eager load paths to be added to the ones defined
32
+ # automatically by Rails. Anything in this collection is considered to be
33
+ # an autoload path regardless of whether it was added to +autoload_paths+.
34
+ #
35
+ # This collection is empty by default, it accepts strings and +Pathname+
36
+ # objects.
37
+ #
38
+ # If you'd like to add +lib+ to it, please see +autoload_lib+.
39
+ attr_reader :eager_load_paths
40
+
12
41
  def initialize(root = nil)
13
42
  super()
14
43
  @root = root
15
44
  @generators = app_generators.dup
16
45
  @middleware = Rails::Configuration::MiddlewareStackProxy.new
17
46
  @javascript_path = "javascript"
47
+
48
+ @autoload_paths = []
49
+ @autoload_once_paths = []
50
+ @eager_load_paths = []
18
51
  end
19
52
 
20
53
  # Holds generators configuration:
@@ -81,16 +114,22 @@ module Rails
81
114
  @root = paths.path = Pathname.new(value).expand_path
82
115
  end
83
116
 
84
- def eager_load_paths
85
- @eager_load_paths ||= paths.eager_load
117
+ # Private method that adds custom autoload paths to the ones defined by
118
+ # +paths+.
119
+ def all_autoload_paths # :nodoc:
120
+ autoload_paths + paths.autoload_paths
86
121
  end
87
122
 
88
- def autoload_once_paths
89
- @autoload_once_paths ||= paths.autoload_once
123
+ # Private method that adds custom autoload once paths to the ones defined
124
+ # by +paths+.
125
+ def all_autoload_once_paths # :nodoc:
126
+ autoload_once_paths + paths.autoload_once
90
127
  end
91
128
 
92
- def autoload_paths
93
- @autoload_paths ||= paths.autoload_paths
129
+ # Private method that adds custom eager load paths to the ones defined by
130
+ # +paths+.
131
+ def all_eager_load_paths # :nodoc:
132
+ eager_load_paths + paths.eager_load
94
133
  end
95
134
  end
96
135
  end
data/lib/rails/engine.rb CHANGED
@@ -300,7 +300,7 @@ module Rails
300
300
  #
301
301
  # == Isolated engine's helpers
302
302
  #
303
- # Sometimes you may want to isolate engine, but use helpers that are defined for it.
303
+ # Sometimes you may want to isolate an engine, but use helpers that are defined for it.
304
304
  # If you want to share just a few specific helpers you can add them to application's
305
305
  # helpers in ApplicationController:
306
306
  #
@@ -578,7 +578,7 @@ module Rails
578
578
  end
579
579
 
580
580
  initializer :set_eager_load_paths, before: :bootstrap_hook do
581
- ActiveSupport::Dependencies._eager_load_paths.merge(config.eager_load_paths)
581
+ ActiveSupport::Dependencies._eager_load_paths.merge(config.all_eager_load_paths)
582
582
  config.eager_load_paths.freeze
583
583
  end
584
584
 
@@ -705,14 +705,14 @@ module Rails
705
705
  end
706
706
 
707
707
  def _all_autoload_once_paths
708
- config.autoload_once_paths.uniq
708
+ config.all_autoload_once_paths.uniq
709
709
  end
710
710
 
711
711
  def _all_autoload_paths
712
712
  @_all_autoload_paths ||= begin
713
- autoload_paths = config.autoload_paths
714
- autoload_paths += config.eager_load_paths
715
- autoload_paths -= config.autoload_once_paths
713
+ autoload_paths = config.all_autoload_paths
714
+ autoload_paths += config.all_eager_load_paths
715
+ autoload_paths -= config.all_autoload_once_paths
716
716
  autoload_paths.uniq
717
717
  end
718
718
  end
@@ -9,7 +9,7 @@ module Rails
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 1
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -172,10 +172,6 @@ module Rails
172
172
  remove_file "config/initializers/permissions_policy.rb"
173
173
  end
174
174
  end
175
-
176
- if !skip_sprockets?
177
- insert_into_file "config/application.rb", %(require "sprockets/railtie"), after: /require\(["']rails\/all["']\)\n/
178
- end
179
175
  end
180
176
 
181
177
  def master_key
@@ -50,8 +50,8 @@ group :development do
50
50
  <%- end -%>
51
51
  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
52
52
  # gem "spring"
53
-
54
53
  <%- if RUBY_VERSION >= "3.1" && RUBY_VERSION < "3.2" -%>
54
+
55
55
  gem "error_highlight", ">= 0.4.0", platforms: [:ruby]
56
56
  <%- end -%>
57
57
  end
@@ -13,7 +13,7 @@ Rails.application.configure do
13
13
  config.eager_load = true
14
14
 
15
15
  # Full error reports are disabled and caching is turned on.
16
- config.consider_all_requests_local = false
16
+ config.consider_all_requests_local = false
17
17
  <%- unless options.api? -%>
18
18
  config.action_controller.perform_caching = true
19
19
  <%- end -%>
@@ -22,8 +22,8 @@ Rails.application.configure do
22
22
  # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
23
23
  # config.require_master_key = true
24
24
 
25
- # Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it).
26
- config.public_file_server.enabled = true
25
+ # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
26
+ # config.public_file_server.enabled = false
27
27
 
28
28
  <%- unless skip_sprockets? -%>
29
29
  # Compress CSS using a preprocessor.
@@ -77,7 +77,7 @@ Rails.application.configure do
77
77
 
78
78
  <%- unless options[:skip_active_job] -%>
79
79
  # Use a real queuing backend for Active Job (and separate queues per environment).
80
- # config.active_job.queue_adapter = :resque
80
+ # config.active_job.queue_adapter = :resque
81
81
  # config.active_job.queue_name_prefix = "<%= app_name %>_production"
82
82
 
83
83
  <%- end -%>
@@ -24,11 +24,11 @@ Rails.application.configure do
24
24
  }
25
25
 
26
26
  # Show full error reports and disable caching.
27
- config.consider_all_requests_local = true
27
+ config.consider_all_requests_local = true
28
28
  config.action_controller.perform_caching = false
29
29
  config.cache_store = :null_store
30
30
 
31
- # Raise exceptions instead of rendering exception templates.
31
+ # Render exception templates for rescuable exceptions and raise for other exceptions.
32
32
  config.action_dispatch.show_exceptions = :rescuable
33
33
 
34
34
  # Disable request forgery protection in test environment.
@@ -9,14 +9,19 @@
9
9
  # Read the Guide for Upgrading Ruby on Rails for more info on each option.
10
10
  # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11
11
 
12
+ ###
12
13
  # No longer add autoloaded paths into `$LOAD_PATH`. This means that you won't be able
13
14
  # to manually require files that are managed by the autoloader, which you shouldn't do anyway.
15
+ #
14
16
  # This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size
15
17
  # of the bootsnap cache if you use it.
18
+ #++
16
19
  # Rails.application.config.add_autoload_paths_to_load_path = false
17
20
 
21
+ ###
18
22
  # Remove the default X-Download-Options headers since it is used only by Internet Explorer.
19
23
  # If you need to support Internet Explorer, add back `"X-Download-Options" => "noopen"`.
24
+ #++
20
25
  # Rails.application.config.action_dispatch.default_headers = {
21
26
  # "X-Frame-Options" => "SAMEORIGIN",
22
27
  # "X-XSS-Protection" => "0",
@@ -25,31 +30,43 @@
25
30
  # "Referrer-Policy" => "strict-origin-when-cross-origin"
26
31
  # }
27
32
 
33
+ ###
28
34
  # Do not treat an `ActionController::Parameters` instance
29
35
  # as equal to an equivalent `Hash` by default.
36
+ #++
30
37
  # Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false
31
38
 
32
- # Active Record Encryption now uses SHA-256 as its hash digest algorithm. Important: If you have
33
- # data encrypted with previous Rails versions, there are two scenarios to consider:
39
+ ###
40
+ # Active Record Encryption now uses SHA-256 as its hash digest algorithm.
41
+ #
42
+ # There are 3 scenarios to consider.
34
43
  #
35
- # 1. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default
44
+ # 1. If you have data encrypted with previous Rails versions, and you have
45
+ # +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default
36
46
  # before Rails 7.0), you need to configure SHA-1 for Active Record Encryption too:
47
+ #++
37
48
  # Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA1
49
+ #
38
50
  # 2. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA256 (the new default
39
51
  # in 7.0), then you need to configure SHA-256 for Active Record Encryption:
52
+ #++
40
53
  # Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA256
41
54
  #
42
- # If you don't currently have data encrypted with Active Record encryption, you can disable this setting to
55
+ # 3. If you don't currently have data encrypted with Active Record encryption, you can disable this setting to
43
56
  # configure the default behavior starting 7.1+:
57
+ #++
44
58
  # Rails.application.config.active_record.encryption.support_sha1_for_non_deterministic_encryption = false
45
59
 
60
+ ###
46
61
  # No longer run after_commit callbacks on the first of multiple Active Record
47
62
  # instances to save changes to the same database row within a transaction.
48
63
  # Instead, run these callbacks on the instance most likely to have internal
49
64
  # state which matches what was committed to the database, typically the last
50
65
  # instance to save.
66
+ #++
51
67
  # Rails.application.config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = false
52
68
 
69
+ ###
53
70
  # Configures SQLite with a strict strings mode, which disables double-quoted string literals.
54
71
  #
55
72
  # SQLite has some quirks around double-quoted string literals.
@@ -57,11 +74,15 @@
57
74
  # it then considers them as string literals. Because of this, typos can silently go unnoticed.
58
75
  # For example, it is possible to create an index for a non existing column.
59
76
  # See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted for more details.
77
+ #++
60
78
  # Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true
61
79
 
62
- # Disable deprecated singular associations names
80
+ ###
81
+ # Disable deprecated singular associations names.
82
+ #++
63
83
  # Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
64
84
 
85
+ ###
65
86
  # Enable the Active Job `BigDecimal` argument serializer, which guarantees
66
87
  # roundtripping. Without this serializer, some queue adapters may serialize
67
88
  # `BigDecimal` arguments as simple (non-roundtrippable) strings.
@@ -70,19 +91,25 @@
70
91
  # replicas will not be able to deserialize `BigDecimal` arguments from this
71
92
  # serializer. Therefore, this setting should only be enabled after all replicas
72
93
  # have been successfully upgraded to Rails 7.1.
94
+ #++
73
95
  # Rails.application.config.active_job.use_big_decimal_serializer = true
74
96
 
97
+ ###
75
98
  # Specify if an `ArgumentError` should be raised if `Rails.cache` `fetch` or
76
99
  # `write` are given an invalid `expires_at` or `expires_in` time.
77
100
  # Options are `true`, and `false`. If `false`, the exception will be reported
78
101
  # as `handled` and logged instead.
102
+ #++
79
103
  # Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true
80
104
 
105
+ ###
81
106
  # Specify whether Query Logs will format tags using the SQLCommenter format
82
107
  # (https://open-telemetry.github.io/opentelemetry-sqlcommenter/), or using the legacy format.
83
108
  # Options are `:legacy` and `:sqlcommenter`.
109
+ #++
84
110
  # Rails.application.config.active_record.query_log_tags_format = :sqlcommenter
85
111
 
112
+ ###
86
113
  # Specify the default serializer used by `MessageEncryptor` and `MessageVerifier`
87
114
  # instances.
88
115
  #
@@ -109,8 +136,10 @@
109
136
  # that have not yet been upgraded must be able to read messages from upgraded
110
137
  # servers, first deploy without changing the serializer, then set the serializer
111
138
  # in a subsequent deploy.
139
+ #++
112
140
  # Rails.application.config.active_support.message_serializer = :json_allow_marshal
113
141
 
142
+ ###
114
143
  # Enable a performance optimization that serializes message data and metadata
115
144
  # together. This changes the message format, so messages serialized this way
116
145
  # cannot be read by older versions of Rails. However, messages that use the old
@@ -120,42 +149,55 @@
120
149
  # not yet been upgraded must be able to read messages from upgraded servers,
121
150
  # leave this optimization off on the first deploy, then enable it on a
122
151
  # subsequent deploy.
152
+ #++
123
153
  # Rails.application.config.active_support.use_message_serializer_for_metadata = true
124
154
 
155
+ ###
125
156
  # Set the maximum size for Rails log files.
126
157
  #
127
158
  # `config.load_defaults 7.1` does not set this value for environments other than
128
159
  # development and test.
129
- #
160
+ #++
130
161
  # if Rails.env.local?
131
162
  # Rails.application.config.log_file_size = 100 * 1024 * 1024
132
163
  # end
133
164
 
165
+ ###
134
166
  # Enable raising on assignment to attr_readonly attributes. The previous
135
167
  # behavior would allow assignment but silently not persist changes to the
136
168
  # database.
169
+ #++
137
170
  # Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true
138
171
 
172
+ ###
139
173
  # Enable validating only parent-related columns for presence when the parent is mandatory.
140
174
  # The previous behavior was to validate the presence of the parent record, which performed an extra query
141
175
  # to get the parent every time the child record was updated, even when parent has not changed.
176
+ #++
142
177
  # Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false
143
178
 
179
+ ###
144
180
  # Enable precompilation of `config.filter_parameters`. Precompilation can
145
181
  # improve filtering performance, depending on the quantity and types of filters.
182
+ #++
146
183
  # Rails.application.config.precompile_filter_parameters = true
147
184
 
185
+ ###
148
186
  # Enable before_committed! callbacks on all enrolled records in a transaction.
149
187
  # The previous behavior was to only run the callbacks on the first copy of a record
150
188
  # if there were multiple copies of the same record enrolled in the transaction.
189
+ #++
151
190
  # Rails.application.config.active_record.before_committed_on_all_records = true
152
191
 
192
+ ###
153
193
  # Disable automatic column serialization into YAML.
154
194
  # To keep the historic behavior, you can set it to `YAML`, however it is
155
195
  # recommended to explicitly define the serialization method for each column
156
196
  # rather than to rely on a global default.
197
+ #++
157
198
  # Rails.application.config.active_record.default_column_serializer = nil
158
199
 
200
+ ###
159
201
  # Enable a performance optimization that serializes Active Record models
160
202
  # in a faster and more compact way.
161
203
  #
@@ -163,32 +205,43 @@
163
205
  # not yet been upgraded must be able to read caches from upgraded servers,
164
206
  # leave this optimization off on the first deploy, then enable it on a
165
207
  # subsequent deploy.
208
+ #++
166
209
  # Rails.application.config.active_record.marshalling_format_version = 7.1
167
210
 
211
+ ###
168
212
  # Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model.
169
213
  # This matches the behaviour of all other callbacks.
170
214
  # In previous versions of Rails, they ran in the inverse order.
215
+ #++
171
216
  # Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true
172
217
 
218
+ ###
173
219
  # Whether a `transaction` block is committed or rolled back when exited via `return`, `break` or `throw`.
174
- #
220
+ #++
175
221
  # Rails.application.config.active_record.commit_transaction_on_non_local_return = true
176
222
 
223
+ ###
177
224
  # Controls when to generate a value for <tt>has_secure_token</tt> declarations.
178
- #
225
+ #++
179
226
  # Rails.application.config.active_record.generate_secure_token_on = :initialize
180
227
 
228
+ ###
181
229
  # ** Please read carefully, this must be configured in config/application.rb **
230
+ #
182
231
  # Change the format of the cache entry.
232
+ #
183
233
  # Changing this default means that all new cache entries added to the cache
184
234
  # will have a different format that is not supported by Rails 7.0
185
235
  # applications.
236
+ #
186
237
  # Only change this value after your application is fully deployed to Rails 7.1
187
238
  # and you have no plans to rollback.
188
239
  # When you're ready to change format, add this to `config/application.rb` (NOT
189
240
  # this file):
190
241
  # config.active_support.cache_format_version = 7.1
191
242
 
243
+
244
+ ###
192
245
  # Configure Action View to use HTML5 standards-compliant sanitizers when they are supported on your
193
246
  # platform.
194
247
  #
@@ -196,9 +249,11 @@
196
249
  # sanitizers if they are supported, else fall back to HTML4 sanitizers.
197
250
  #
198
251
  # In previous versions of Rails, Action View always used `Rails::HTML4::Sanitizer` as its vendor.
199
- #
252
+ #++
200
253
  # Rails.application.config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
201
254
 
255
+
256
+ ###
202
257
  # Configure Action Text to use an HTML5 standards-compliant sanitizer when it is supported on your
203
258
  # platform.
204
259
  #
@@ -206,18 +261,23 @@
206
261
  # sanitizers if they are supported, else fall back to HTML4 sanitizers.
207
262
  #
208
263
  # In previous versions of Rails, Action Text always used `Rails::HTML4::Sanitizer` as its vendor.
209
- #
264
+ #++
210
265
  # Rails.application.config.action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
211
266
 
267
+
268
+ ###
212
269
  # Configure the log level used by the DebugExceptions middleware when logging
213
- # uncaught exceptions during requests
270
+ # uncaught exceptions during requests.
271
+ #++
214
272
  # Rails.application.config.action_dispatch.debug_exception_log_level = :error
215
273
 
274
+
275
+ ###
216
276
  # Configure the test helpers in Action View, Action Dispatch, and rails-dom-testing to use HTML5
217
277
  # parsers.
218
278
  #
219
279
  # Nokogiri::HTML5 isn't supported on JRuby, so JRuby applications must set this to :html4.
220
280
  #
221
281
  # In previous versions of Rails, these test helpers always used an HTML4 parser.
222
- #
282
+ #++
223
283
  # Rails.application.config.dom_testing_default_html_version = :html5
@@ -41,6 +41,9 @@ module Rails
41
41
  end
42
42
 
43
43
  def edit_dockerfile
44
+ dockerfile_path = File.expand_path("Dockerfile", destination_root)
45
+ return unless File.exist?(dockerfile_path)
46
+
44
47
  build_name = docker_for_database_build
45
48
  deploy_name = docker_for_database_deploy
46
49
  if build_name
@@ -1,11 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- eager_load = ->() do
4
- puts "Hold on, I am eager loading the application."
5
- Zeitwerk::Loader.eager_load_all
6
- end
3
+ require "rails/zeitwerk_checker"
7
4
 
8
- report_not_checked = ->(not_checked) do
5
+ report_unchecked = ->(unchecked) do
9
6
  puts
10
7
  puts <<~EOS
11
8
  WARNING: The following directories will only be checked if you configure
@@ -13,7 +10,7 @@ report_not_checked = ->(not_checked) do
13
10
  EOS
14
11
  puts
15
12
 
16
- not_checked.each { |dir| puts " #{dir}" }
13
+ unchecked.each { |dir| puts " #{dir}" }
17
14
  puts
18
15
 
19
16
  puts <<~EOS
@@ -23,39 +20,22 @@ report_not_checked = ->(not_checked) do
23
20
  puts
24
21
  end
25
22
 
26
- report = ->(not_checked) do
27
- if not_checked.any?
28
- report_not_checked[not_checked]
29
- puts "Otherwise, all is good!"
30
- else
31
- puts "All is good!"
32
- end
33
- end
34
-
35
23
  namespace :zeitwerk do
36
24
  desc "Check project structure for Zeitwerk compatibility"
37
25
  task check: :environment do
26
+ puts "Hold on, I am eager loading the application."
27
+
38
28
  begin
39
- eager_load[]
40
- rescue NameError => e
41
- if e.message =~ /expected file .*? to define constant [\w:]+/
42
- abort $&.sub(/expected file #{Regexp.escape(Rails.root.to_s)}./, "expected file ")
43
- else
44
- raise
45
- end
29
+ unchecked = Rails::ZeitwerkChecker.check
30
+ rescue Zeitwerk::NameError => e
31
+ abort e.message.sub(/#{Regexp.escape(Rails.root.to_s)}./, "")
46
32
  end
47
33
 
48
- require "active_support/core_ext/object/try"
49
- eager_load_paths = Rails.configuration.eager_load_namespaces.filter_map do |eln|
50
- # Quick regression fix for 6.0.3 to support namespaces that do not have
51
- # eager load paths, like the recently added i18n. I'll rewrite this task.
52
- eln.try(:config).try(:eager_load_paths)
53
- end.flatten
54
-
55
- not_checked = ActiveSupport::Dependencies.autoload_paths - eager_load_paths
56
- not_checked.select! { |dir| Dir.exist?(dir) }
57
- not_checked.reject! { |dir| Dir.empty?(dir) }
58
-
59
- report[not_checked]
34
+ if unchecked.empty?
35
+ puts "All is good!"
36
+ else
37
+ report_unchecked[unchecked]
38
+ puts "Otherwise, all is good!"
39
+ end
60
40
  end
61
41
  end
@@ -44,6 +44,13 @@
44
44
  content: "\00a0"; // &nbsp;
45
45
  }
46
46
 
47
+ th {
48
+ font-weight: inherit;
49
+ color: #7f7f7f;
50
+ text-align: right;
51
+ white-space: nowrap;
52
+ }
53
+
47
54
  iframe {
48
55
  border: 0;
49
56
  width: 100%;
@@ -134,7 +141,7 @@
134
141
  <table>
135
142
  <% @email.header_fields.each do |field| %>
136
143
  <tr>
137
- <td align="right" style="color: #7f7f7f"><%= field.name %>:</td>
144
+ <th><%= field.name %>:</th>
138
145
  <td><%= field.value %></td>
139
146
  </tr>
140
147
  <% end %>
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The actual (private) implementation of the Rake task zeitwerk:check.
4
+ class Rails::ZeitwerkChecker # :nodoc:
5
+ def self.check
6
+ Zeitwerk::Loader.eager_load_all
7
+
8
+ autoloaded = ActiveSupport::Dependencies.autoload_paths + ActiveSupport::Dependencies.autoload_once_paths
9
+ eager_loaded = ActiveSupport::Dependencies._eager_load_paths.to_a
10
+
11
+ unchecked = autoloaded - eager_loaded
12
+ unchecked.select! { |dir| Dir.exist?(dir) && !Dir.empty?(dir) }
13
+ unchecked
14
+ end
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.1
4
+ version: 7.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-11 00:00:00.000000000 Z
11
+ date: 2023-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 7.1.1
19
+ version: 7.1.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 7.1.1
26
+ version: 7.1.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 7.1.1
33
+ version: 7.1.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 7.1.1
40
+ version: 7.1.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rackup
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 7.1.1
123
+ version: 7.1.2
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 7.1.1
130
+ version: 7.1.2
131
131
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
132
132
  email: david@loudthinking.com
133
133
  executables:
@@ -453,15 +453,16 @@ files:
453
453
  - lib/rails/testing/maintain_test_schema.rb
454
454
  - lib/rails/version.rb
455
455
  - lib/rails/welcome_controller.rb
456
+ - lib/rails/zeitwerk_checker.rb
456
457
  homepage: https://rubyonrails.org
457
458
  licenses:
458
459
  - MIT
459
460
  metadata:
460
461
  bug_tracker_uri: https://github.com/rails/rails/issues
461
- changelog_uri: https://github.com/rails/rails/blob/v7.1.1/railties/CHANGELOG.md
462
- documentation_uri: https://api.rubyonrails.org/v7.1.1/
462
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.2/railties/CHANGELOG.md
463
+ documentation_uri: https://api.rubyonrails.org/v7.1.2/
463
464
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
464
- source_code_uri: https://github.com/rails/rails/tree/v7.1.1/railties
465
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.2/railties
465
466
  rubygems_mfa_required: 'true'
466
467
  post_install_message:
467
468
  rdoc_options: