railties 7.1.1 → 7.1.3

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: 8c529251b08d62ea8d3e2b261f9863382b32783ef34f1af4a50f3cc9bff1abc3
4
+ data.tar.gz: 3b8d46f6bea256a8e7998e9c44589d0ce8c0cdc9064a96083167ac9043e57f17
5
5
  SHA512:
6
- metadata.gz: ac990f46b016fbc43c559511596e6c6e84a911dd1d5ae3cee65746cefd9f84691979e55f02c5d0a50da4d55720b44d72609db3da6fe9d507927d64a7030a6c5a
7
- data.tar.gz: f8bf05ced8bfdc32dd941eaac774b9daa70878480d9c3331b02450c4bd5aa4f1cc98c9cba5840a11f2c0e3c2880c822b045bb5f751992ac5eaf461c333f33f07
6
+ metadata.gz: a9883784c3d94e282969fe8ab8e2de689a824b66369b18fd902111671376152ac97d2a17427c1145bfdf11ea20bcb7d896cac66a4ba1dfd7245236805dc8be3b
7
+ data.tar.gz: bf25c78a46a71fd9c27c02f9432ffd97bc308c5567911d8cabffb9ea5b784e5ec015bc7a2f820d67cbfff70b1dbac9a9a9f19a7a86467b503ab31015b5909659
data/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ ## Rails 7.1.3 (January 16, 2024) ##
2
+
3
+ * Make sure `config.after_routes_loaded` hook runs on boot.
4
+
5
+ *Rafael Mendonça França*
6
+
7
+ * Fix `config.log_level` not being respected when using a `BroadcastLogger`
8
+
9
+ *Édouard Chin*
10
+
11
+ * Fix isolated engines to take `ActiveRecord::Base.table_name_prefix` into consideration.
12
+ This will allow for engine defined models, such as inside Active Storage, to respect
13
+ Active Record table name prefix configuration.
14
+
15
+ *Chedli Bourguiba*
16
+
17
+ * The `bin/rails app:template` command will no longer add potentially unwanted
18
+ gem platforms via `bundle lock --add-platform=...` commands.
19
+
20
+ *Jonathan Hefner*
21
+
22
+
23
+ ## Rails 7.1.2 (November 10, 2023) ##
24
+
25
+ * Fix running `db:system:change` when app has no Dockerfile.
26
+
27
+ *Hartley McGuire*
28
+
29
+ * If you accessed `config.eager_load_paths` and friends, later changes to
30
+ `config.paths` were not reflected in the expected auto/eager load paths.
31
+ Now, they are.
32
+
33
+ This bug has been latent since Rails 3.
34
+
35
+ Fixes #49629.
36
+
37
+ *Xavier Noria*
38
+
1
39
  ## Rails 7.1.1 (October 11, 2023) ##
2
40
 
3
41
  * Ensures the Rails generated Dockerfile uses correct ruby version and matches Gemfile.
@@ -54,9 +54,13 @@ 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
- unless Rails.logger.is_a?(ActiveSupport::BroadcastLogger)
58
+ if Rails.logger.is_a?(ActiveSupport::BroadcastLogger)
59
+ if config.broadcast_log_level
60
+ Rails.logger.level = ActiveSupport::Logger.const_get(config.broadcast_log_level.to_s.upcase)
61
+ end
62
+ else
63
+ Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
60
64
  broadcast_logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
61
65
  broadcast_logger.formatter = Rails.logger.formatter
62
66
  Rails.logger = broadcast_logger
@@ -19,13 +19,13 @@ module Rails
19
19
  :ssl_options, :public_file_server,
20
20
  :session_options, :time_zone, :reload_classes_only_on_change,
21
21
  :beginning_of_week, :filter_redirect, :x,
22
- :read_encrypted_secrets, :log_level, :content_security_policy_report_only,
22
+ :read_encrypted_secrets, :content_security_policy_report_only,
23
23
  :content_security_policy_nonce_generator, :content_security_policy_nonce_directives,
24
24
  :require_master_key, :credentials, :disable_sandbox, :sandbox_by_default,
25
25
  :add_autoload_paths_to_load_path, :rake_eager_load, :server_timing, :log_file_size,
26
26
  :dom_testing_default_html_version
27
27
 
28
- attr_reader :encoding, :api_only, :loaded_config_version
28
+ attr_reader :encoding, :api_only, :loaded_config_version, :log_level
29
29
 
30
30
  def initialize(*)
31
31
  super
@@ -379,6 +379,15 @@ module Rails
379
379
  @debug_exception_response_format ||= :api
380
380
  end
381
381
 
382
+ def log_level=(level)
383
+ @log_level = level
384
+ @broadcast_log_level = level
385
+ end
386
+
387
+ def broadcast_log_level # :nodoc:
388
+ defined?(@broadcast_log_level) ? @broadcast_log_level : nil
389
+ end
390
+
382
391
  def debug_exception_response_format
383
392
  @debug_exception_response_format || :default
384
393
  end
@@ -160,6 +160,7 @@ module Rails
160
160
  reloader.eager_load = app.config.eager_load
161
161
  reloader.execute
162
162
  reloaders << reloader
163
+
163
164
  app.reloader.to_run do
164
165
  # We configure #execute rather than #execute_if_updated because if
165
166
  # autoloaded constants are cleared we need to reload routes also in
@@ -174,6 +175,8 @@ module Rails
174
175
  reloader.execute
175
176
  ActiveSupport.run_load_hooks(:after_routes_loaded, self)
176
177
  end
178
+
179
+ ActiveSupport.run_load_hooks(:after_routes_loaded, self)
177
180
  end
178
181
 
179
182
  # Set clearing dependencies after the finisher hook to ensure paths
@@ -234,8 +234,7 @@ module Rails
234
234
  end
235
235
 
236
236
  # Convenience for loading config/foo.yml for the current \Rails env.
237
- #
238
- # Examples:
237
+ # Example:
239
238
  #
240
239
  # # config/exception_notification.yml:
241
240
  # production:
@@ -246,13 +245,15 @@ module Rails
246
245
  # url: http://localhost:3001
247
246
  # namespace: my_app_development
248
247
  #
248
+ # <code></code>
249
+ #
249
250
  # # config/environments/production.rb
250
251
  # Rails.application.configure do
251
252
  # config.middleware.use ExceptionNotifier, config_for(:exception_notification)
252
253
  # end
253
254
  #
254
- # # You can also store configurations in a shared section which will be
255
- # # merged with the environment configuration
255
+ # You can also store configurations in a shared section which will be merged
256
+ # with the environment configuration
256
257
  #
257
258
  # # config/example.yml
258
259
  # shared:
@@ -265,6 +266,8 @@ module Rails
265
266
  # bar:
266
267
  # qux: 2
267
268
  #
269
+ # <code></code>
270
+ #
268
271
  # # development environment
269
272
  # Rails.application.config_for(:example)[:foo][:bar]
270
273
  # # => { baz: 1, qux: 2 }
@@ -477,7 +480,21 @@ module Rails
477
480
  config.secret_key_base ||= generate_local_secret
478
481
  else
479
482
  validate_secret_key_base(
480
- ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base
483
+ ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || begin
484
+ secret_skb = secrets_secret_key_base
485
+
486
+ if secret_skb.equal?(config.secret_key_base)
487
+ config.secret_key_base
488
+ else
489
+ Rails.deprecator.warn(<<~MSG.squish)
490
+ Your `secret_key_base` is configured in `Rails.application.secrets`,
491
+ which is deprecated in favor of `Rails.application.credentials` and
492
+ will be removed in Rails 7.2.
493
+ MSG
494
+
495
+ secret_skb
496
+ end
497
+ end
481
498
  )
482
499
  end
483
500
  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
@@ -15,7 +15,8 @@ module Rails
15
15
  # feature and application sharing.
16
16
  #
17
17
  # Any +Rails::Engine+ is also a Rails::Railtie, so the same
18
- # methods (like <tt>rake_tasks</tt> and +generators+) and configuration
18
+ # methods (like {rake_tasks}[rdoc-ref:Rails::Railtie::rake_tasks] and
19
+ # {generators}[rdoc-ref:Rails::Railtie::generators]) and configuration
19
20
  # options that are available in railties can also be used in engines.
20
21
  #
21
22
  # == Creating an Engine
@@ -116,7 +117,7 @@ module Rails
116
117
  # An engine can also be a Rack application. It can be useful if you have a Rack application that
117
118
  # you would like to provide with some of the +Engine+'s features.
118
119
  #
119
- # To do that, use the +endpoint+ method:
120
+ # To do that, use the ::endpoint method:
120
121
  #
121
122
  # module MyEngine
122
123
  # class Engine < Rails::Engine
@@ -197,7 +198,7 @@ module Rails
197
198
  # named routes from the application will be available to your engine's controllers as well.
198
199
  #
199
200
  # However, sometimes you want to isolate your engine from the application, especially if your engine
200
- # has its own router. To do that, you simply need to call +isolate_namespace+. This method requires
201
+ # has its own router. To do that, you simply need to call ::isolate_namespace. This method requires
201
202
  # you to pass a module where all your controllers, helpers, and models should be nested to:
202
203
  #
203
204
  # module MyEngine
@@ -300,7 +301,7 @@ module Rails
300
301
  #
301
302
  # == Isolated engine's helpers
302
303
  #
303
- # Sometimes you may want to isolate engine, but use helpers that are defined for it.
304
+ # Sometimes you may want to isolate an engine, but use helpers that are defined for it.
304
305
  # If you want to share just a few specific helpers you can add them to application's
305
306
  # helpers in ApplicationController:
306
307
  #
@@ -327,7 +328,7 @@ module Rails
327
328
  # To use engine's migrations in application you can use the rake task below, which copies them to
328
329
  # application's dir:
329
330
  #
330
- # rake ENGINE_NAME:install:migrations
331
+ # $ rake ENGINE_NAME:install:migrations
331
332
  #
332
333
  # Note that some of the migrations may be skipped if a migration with the same name already exists
333
334
  # in application. In such a situation you must decide whether to leave that migration or rename the
@@ -395,6 +396,12 @@ module Rails
395
396
 
396
397
  unless mod.respond_to?(:table_name_prefix)
397
398
  define_method(:table_name_prefix) { "#{name}_" }
399
+
400
+ ActiveSupport.on_load(:active_record) do
401
+ mod.singleton_class.redefine_method(:table_name_prefix) do
402
+ "#{ActiveRecord::Base.table_name_prefix}#{name}_"
403
+ end
404
+ end
398
405
  end
399
406
 
400
407
  unless mod.respond_to?(:use_relative_model_naming?)
@@ -578,7 +585,7 @@ module Rails
578
585
  end
579
586
 
580
587
  initializer :set_eager_load_paths, before: :bootstrap_hook do
581
- ActiveSupport::Dependencies._eager_load_paths.merge(config.eager_load_paths)
588
+ ActiveSupport::Dependencies._eager_load_paths.merge(config.all_eager_load_paths)
582
589
  config.eager_load_paths.freeze
583
590
  end
584
591
 
@@ -705,14 +712,14 @@ module Rails
705
712
  end
706
713
 
707
714
  def _all_autoload_once_paths
708
- config.autoload_once_paths.uniq
715
+ config.all_autoload_once_paths.uniq
709
716
  end
710
717
 
711
718
  def _all_autoload_paths
712
719
  @_all_autoload_paths ||= begin
713
- autoload_paths = config.autoload_paths
714
- autoload_paths += config.eager_load_paths
715
- autoload_paths -= config.autoload_once_paths
720
+ autoload_paths = config.all_autoload_paths
721
+ autoload_paths += config.all_eager_load_paths
722
+ autoload_paths -= config.all_autoload_once_paths
716
723
  autoload_paths.uniq
717
724
  end
718
725
  end
@@ -9,7 +9,7 @@ module Rails
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 1
12
- TINY = 1
12
+ TINY = 3
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -674,19 +674,7 @@ module Rails
674
674
  end
675
675
 
676
676
  def run_bundle
677
- if bundle_install?
678
- bundle_command("install", "BUNDLE_IGNORE_MESSAGES" => "1")
679
-
680
- # The vast majority of Rails apps will be deployed on `x86_64-linux`.
681
- platforms = ["--add-platform=x86_64-linux"]
682
-
683
- # Users that develop on M1 mac may use docker and would need `aarch64-linux` as well.
684
- platforms << "--add-platform=aarch64-linux" if RUBY_PLATFORM.start_with?("arm64")
685
-
686
- platforms.each do |platform|
687
- bundle_command("lock #{platform}", "BUNDLE_IGNORE_MESSAGES" => "1")
688
- end
689
- end
677
+ bundle_command("install", "BUNDLE_IGNORE_MESSAGES" => "1") if bundle_install?
690
678
  end
691
679
 
692
680
  def run_javascript
@@ -716,6 +704,16 @@ module Rails
716
704
  end
717
705
  end
718
706
 
707
+ def add_bundler_platforms
708
+ if bundle_install?
709
+ # The vast majority of Rails apps will be deployed on `x86_64-linux`.
710
+ bundle_command("lock --add-platform=x86_64-linux")
711
+
712
+ # Users that develop on M1 mac may use docker and would need `aarch64-linux` as well.
713
+ bundle_command("lock --add-platform=aarch64-linux") if RUBY_PLATFORM.start_with?("arm64")
714
+ end
715
+ end
716
+
719
717
  def generate_bundler_binstub
720
718
  if bundle_install?
721
719
  bundle_command("binstubs bundler")
@@ -79,7 +79,7 @@ module Rails
79
79
  #
80
80
  # For example, if the user invoke the controller generator as:
81
81
  #
82
- # bin/rails generate controller Account --test-framework=test_unit
82
+ # $ bin/rails generate controller Account --test-framework=test_unit
83
83
  #
84
84
  # The controller generator will then try to invoke the following generators:
85
85
  #
@@ -134,11 +134,11 @@ module Rails
134
134
  # All hooks come with switches for user interface. If you do not want
135
135
  # to use any test framework, you can do:
136
136
  #
137
- # bin/rails generate controller Account --skip-test-framework
137
+ # $ bin/rails generate controller Account --skip-test-framework
138
138
  #
139
139
  # Or similarly:
140
140
  #
141
- # bin/rails generate controller Account --no-test-framework
141
+ # $ bin/rails generate controller Account --no-test-framework
142
142
  #
143
143
  # ==== Boolean hooks
144
144
  #
@@ -150,7 +150,7 @@ module Rails
150
150
  #
151
151
  # Then, if you want webrat to be invoked, just supply:
152
152
  #
153
- # bin/rails generate controller Account --webrat
153
+ # $ bin/rails generate controller Account --webrat
154
154
  #
155
155
  # The hooks lookup is similar as above:
156
156
  #
@@ -222,7 +222,7 @@ module Rails
222
222
  end
223
223
 
224
224
  # Returns the default source root for a given generator. This is used internally
225
- # by rails to set its generators source root. If you want to customize your source
225
+ # by \Rails to set its generators source root. If you want to customize your source
226
226
  # root, you should use source_root.
227
227
  def self.default_source_root
228
228
  return unless base_name && generator_name
@@ -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
@@ -547,6 +543,7 @@ module Rails
547
543
 
548
544
  public_task :apply_rails_template
549
545
  public_task :run_bundle
546
+ public_task :add_bundler_platforms
550
547
  public_task :generate_bundler_binstub
551
548
  public_task :run_javascript
552
549
  public_task :run_hotwire
@@ -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,14 +22,14 @@ 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.
30
30
  # config.assets.css_compressor = :sass
31
31
 
32
- # Do not fallback to assets pipeline if a precompiled asset is missed.
32
+ # Do not fall back to assets pipeline if a precompiled asset is missed.
33
33
  config.assets.compile = false
34
34
 
35
35
  <%- end -%>
@@ -67,7 +67,7 @@ Rails.application.configure do
67
67
  # Prepend all log lines with the following tags.
68
68
  config.log_tags = [ :request_id ]
69
69
 
70
- # Info include generic and useful information about system operation, but avoids logging too much
70
+ # "info" includes generic and useful information about system operation, but avoids logging too much
71
71
  # information to avoid inadvertent exposure of personally identifiable information (PII). If you
72
72
  # want to log everything, set the level to "debug".
73
73
  config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
@@ -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,20 @@
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.
16
- # Rails.application.config.add_autoload_paths_to_load_path = false
18
+ #
19
+ # To set this configuration, add the following line to `config/application.rb` (NOT this file):
20
+ # config.add_autoload_paths_to_load_path = false
17
21
 
22
+ ###
18
23
  # Remove the default X-Download-Options headers since it is used only by Internet Explorer.
19
24
  # If you need to support Internet Explorer, add back `"X-Download-Options" => "noopen"`.
25
+ #++
20
26
  # Rails.application.config.action_dispatch.default_headers = {
21
27
  # "X-Frame-Options" => "SAMEORIGIN",
22
28
  # "X-XSS-Protection" => "0",
@@ -25,31 +31,43 @@
25
31
  # "Referrer-Policy" => "strict-origin-when-cross-origin"
26
32
  # }
27
33
 
34
+ ###
28
35
  # Do not treat an `ActionController::Parameters` instance
29
36
  # as equal to an equivalent `Hash` by default.
37
+ #++
30
38
  # Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false
31
39
 
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:
40
+ ###
41
+ # Active Record Encryption now uses SHA-256 as its hash digest algorithm.
42
+ #
43
+ # There are 3 scenarios to consider.
34
44
  #
35
- # 1. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default
45
+ # 1. If you have data encrypted with previous Rails versions, and you have
46
+ # +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default
36
47
  # before Rails 7.0), you need to configure SHA-1 for Active Record Encryption too:
48
+ #++
37
49
  # Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA1
50
+ #
38
51
  # 2. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA256 (the new default
39
52
  # in 7.0), then you need to configure SHA-256 for Active Record Encryption:
53
+ #++
40
54
  # Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA256
41
55
  #
42
- # If you don't currently have data encrypted with Active Record encryption, you can disable this setting to
56
+ # 3. If you don't currently have data encrypted with Active Record encryption, you can disable this setting to
43
57
  # configure the default behavior starting 7.1+:
58
+ #++
44
59
  # Rails.application.config.active_record.encryption.support_sha1_for_non_deterministic_encryption = false
45
60
 
61
+ ###
46
62
  # No longer run after_commit callbacks on the first of multiple Active Record
47
63
  # instances to save changes to the same database row within a transaction.
48
64
  # Instead, run these callbacks on the instance most likely to have internal
49
65
  # state which matches what was committed to the database, typically the last
50
66
  # instance to save.
67
+ #++
51
68
  # Rails.application.config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = false
52
69
 
70
+ ###
53
71
  # Configures SQLite with a strict strings mode, which disables double-quoted string literals.
54
72
  #
55
73
  # SQLite has some quirks around double-quoted string literals.
@@ -57,11 +75,15 @@
57
75
  # it then considers them as string literals. Because of this, typos can silently go unnoticed.
58
76
  # For example, it is possible to create an index for a non existing column.
59
77
  # See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted for more details.
78
+ #++
60
79
  # Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true
61
80
 
62
- # Disable deprecated singular associations names
81
+ ###
82
+ # Disable deprecated singular associations names.
83
+ #++
63
84
  # Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
64
85
 
86
+ ###
65
87
  # Enable the Active Job `BigDecimal` argument serializer, which guarantees
66
88
  # roundtripping. Without this serializer, some queue adapters may serialize
67
89
  # `BigDecimal` arguments as simple (non-roundtrippable) strings.
@@ -70,19 +92,25 @@
70
92
  # replicas will not be able to deserialize `BigDecimal` arguments from this
71
93
  # serializer. Therefore, this setting should only be enabled after all replicas
72
94
  # have been successfully upgraded to Rails 7.1.
95
+ #++
73
96
  # Rails.application.config.active_job.use_big_decimal_serializer = true
74
97
 
98
+ ###
75
99
  # Specify if an `ArgumentError` should be raised if `Rails.cache` `fetch` or
76
100
  # `write` are given an invalid `expires_at` or `expires_in` time.
77
101
  # Options are `true`, and `false`. If `false`, the exception will be reported
78
102
  # as `handled` and logged instead.
103
+ #++
79
104
  # Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true
80
105
 
106
+ ###
81
107
  # Specify whether Query Logs will format tags using the SQLCommenter format
82
108
  # (https://open-telemetry.github.io/opentelemetry-sqlcommenter/), or using the legacy format.
83
109
  # Options are `:legacy` and `:sqlcommenter`.
110
+ #++
84
111
  # Rails.application.config.active_record.query_log_tags_format = :sqlcommenter
85
112
 
113
+ ###
86
114
  # Specify the default serializer used by `MessageEncryptor` and `MessageVerifier`
87
115
  # instances.
88
116
  #
@@ -109,8 +137,10 @@
109
137
  # that have not yet been upgraded must be able to read messages from upgraded
110
138
  # servers, first deploy without changing the serializer, then set the serializer
111
139
  # in a subsequent deploy.
140
+ #++
112
141
  # Rails.application.config.active_support.message_serializer = :json_allow_marshal
113
142
 
143
+ ###
114
144
  # Enable a performance optimization that serializes message data and metadata
115
145
  # together. This changes the message format, so messages serialized this way
116
146
  # cannot be read by older versions of Rails. However, messages that use the old
@@ -120,42 +150,55 @@
120
150
  # not yet been upgraded must be able to read messages from upgraded servers,
121
151
  # leave this optimization off on the first deploy, then enable it on a
122
152
  # subsequent deploy.
153
+ #++
123
154
  # Rails.application.config.active_support.use_message_serializer_for_metadata = true
124
155
 
156
+ ###
125
157
  # Set the maximum size for Rails log files.
126
158
  #
127
159
  # `config.load_defaults 7.1` does not set this value for environments other than
128
160
  # development and test.
129
- #
161
+ #++
130
162
  # if Rails.env.local?
131
163
  # Rails.application.config.log_file_size = 100 * 1024 * 1024
132
164
  # end
133
165
 
166
+ ###
134
167
  # Enable raising on assignment to attr_readonly attributes. The previous
135
168
  # behavior would allow assignment but silently not persist changes to the
136
169
  # database.
170
+ #++
137
171
  # Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true
138
172
 
173
+ ###
139
174
  # Enable validating only parent-related columns for presence when the parent is mandatory.
140
175
  # The previous behavior was to validate the presence of the parent record, which performed an extra query
141
176
  # to get the parent every time the child record was updated, even when parent has not changed.
177
+ #++
142
178
  # Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false
143
179
 
180
+ ###
144
181
  # Enable precompilation of `config.filter_parameters`. Precompilation can
145
182
  # improve filtering performance, depending on the quantity and types of filters.
183
+ #++
146
184
  # Rails.application.config.precompile_filter_parameters = true
147
185
 
186
+ ###
148
187
  # Enable before_committed! callbacks on all enrolled records in a transaction.
149
188
  # The previous behavior was to only run the callbacks on the first copy of a record
150
189
  # if there were multiple copies of the same record enrolled in the transaction.
190
+ #++
151
191
  # Rails.application.config.active_record.before_committed_on_all_records = true
152
192
 
193
+ ###
153
194
  # Disable automatic column serialization into YAML.
154
195
  # To keep the historic behavior, you can set it to `YAML`, however it is
155
196
  # recommended to explicitly define the serialization method for each column
156
197
  # rather than to rely on a global default.
198
+ #++
157
199
  # Rails.application.config.active_record.default_column_serializer = nil
158
200
 
201
+ ###
159
202
  # Enable a performance optimization that serializes Active Record models
160
203
  # in a faster and more compact way.
161
204
  #
@@ -163,32 +206,43 @@
163
206
  # not yet been upgraded must be able to read caches from upgraded servers,
164
207
  # leave this optimization off on the first deploy, then enable it on a
165
208
  # subsequent deploy.
209
+ #++
166
210
  # Rails.application.config.active_record.marshalling_format_version = 7.1
167
211
 
212
+ ###
168
213
  # Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model.
169
214
  # This matches the behaviour of all other callbacks.
170
215
  # In previous versions of Rails, they ran in the inverse order.
216
+ #++
171
217
  # Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true
172
218
 
219
+ ###
173
220
  # Whether a `transaction` block is committed or rolled back when exited via `return`, `break` or `throw`.
174
- #
221
+ #++
175
222
  # Rails.application.config.active_record.commit_transaction_on_non_local_return = true
176
223
 
224
+ ###
177
225
  # Controls when to generate a value for <tt>has_secure_token</tt> declarations.
178
- #
226
+ #++
179
227
  # Rails.application.config.active_record.generate_secure_token_on = :initialize
180
228
 
229
+ ###
181
230
  # ** Please read carefully, this must be configured in config/application.rb **
231
+ #
182
232
  # Change the format of the cache entry.
233
+ #
183
234
  # Changing this default means that all new cache entries added to the cache
184
235
  # will have a different format that is not supported by Rails 7.0
185
236
  # applications.
237
+ #
186
238
  # Only change this value after your application is fully deployed to Rails 7.1
187
239
  # and you have no plans to rollback.
188
240
  # When you're ready to change format, add this to `config/application.rb` (NOT
189
241
  # this file):
190
242
  # config.active_support.cache_format_version = 7.1
191
243
 
244
+
245
+ ###
192
246
  # Configure Action View to use HTML5 standards-compliant sanitizers when they are supported on your
193
247
  # platform.
194
248
  #
@@ -196,9 +250,11 @@
196
250
  # sanitizers if they are supported, else fall back to HTML4 sanitizers.
197
251
  #
198
252
  # In previous versions of Rails, Action View always used `Rails::HTML4::Sanitizer` as its vendor.
199
- #
253
+ #++
200
254
  # Rails.application.config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
201
255
 
256
+
257
+ ###
202
258
  # Configure Action Text to use an HTML5 standards-compliant sanitizer when it is supported on your
203
259
  # platform.
204
260
  #
@@ -206,18 +262,23 @@
206
262
  # sanitizers if they are supported, else fall back to HTML4 sanitizers.
207
263
  #
208
264
  # In previous versions of Rails, Action Text always used `Rails::HTML4::Sanitizer` as its vendor.
209
- #
265
+ #++
210
266
  # Rails.application.config.action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
211
267
 
268
+
269
+ ###
212
270
  # Configure the log level used by the DebugExceptions middleware when logging
213
- # uncaught exceptions during requests
271
+ # uncaught exceptions during requests.
272
+ #++
214
273
  # Rails.application.config.action_dispatch.debug_exception_log_level = :error
215
274
 
275
+
276
+ ###
216
277
  # Configure the test helpers in Action View, Action Dispatch, and rails-dom-testing to use HTML5
217
278
  # parsers.
218
279
  #
219
280
  # Nokogiri::HTML5 isn't supported on JRuby, so JRuby applications must set this to :html4.
220
281
  #
221
282
  # In previous versions of Rails, these test helpers always used an HTML4 parser.
222
- #
283
+ #++
223
284
  # 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
@@ -90,7 +90,7 @@ module Rails
90
90
  end
91
91
 
92
92
  # Hold configured generators fallbacks. If a plugin developer wants a
93
- # generator group to fallback to another group in case of missing generators,
93
+ # generator group to fall back to another group in case of missing generators,
94
94
  # they can add a fallback.
95
95
  #
96
96
  # For example, shoulda is considered a test_framework and is an extension
@@ -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.3
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: 2024-01-16 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.3
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.3
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.3
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.3
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.3
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.3
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.3/railties/CHANGELOG.md
463
+ documentation_uri: https://api.rubyonrails.org/v7.1.3/
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.3/railties
465
466
  rubygems_mfa_required: 'true'
466
467
  post_install_message:
467
468
  rdoc_options: