railties 7.1.2 → 7.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2eaeb12aa4c0fb4003d5caa465f16d95ed6e3b273b9cbd7416ec9197fcfafbe1
4
- data.tar.gz: 6d4060833d16239706518d1486c2fc80908292a9c2e9e9f16e7c2110d6b40e30
3
+ metadata.gz: 8c529251b08d62ea8d3e2b261f9863382b32783ef34f1af4a50f3cc9bff1abc3
4
+ data.tar.gz: 3b8d46f6bea256a8e7998e9c44589d0ce8c0cdc9064a96083167ac9043e57f17
5
5
  SHA512:
6
- metadata.gz: 04f4eeedc7a35ea369cc617225e6029e87ed1f471e2f1212a62b00e6de75418b81050e7eec0f209deeb6a8b6fb2cd0b1820fcf3c379bd63c26c3bdeff4d42353
7
- data.tar.gz: 06e0ad10659ce5fbde4af09fe583accd6d8dba8c792b8fa2024871d28c513eeada26af15e70a97f4599685bf910c1a958e99470d0073166bbce4e85ee17c1b60
6
+ metadata.gz: a9883784c3d94e282969fe8ab8e2de689a824b66369b18fd902111671376152ac97d2a17427c1145bfdf11ea20bcb7d896cac66a4ba1dfd7245236805dc8be3b
7
+ data.tar.gz: bf25c78a46a71fd9c27c02f9432ffd97bc308c5567911d8cabffb9ea5b784e5ec015bc7a2f820d67cbfff70b1dbac9a9a9f19a7a86467b503ab31015b5909659
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
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
+
1
23
  ## Rails 7.1.2 (November 10, 2023) ##
2
24
 
3
25
  * Fix running `db:system:change` when app has no Dockerfile.
@@ -55,7 +55,11 @@ module Rails
55
55
  logger
56
56
  end
57
57
 
58
- 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
59
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
@@ -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 }
@@ -484,7 +487,7 @@ module Rails
484
487
  config.secret_key_base
485
488
  else
486
489
  Rails.deprecator.warn(<<~MSG.squish)
487
- Your `secret_key_base is configured in `Rails.application.secrets`,
490
+ Your `secret_key_base` is configured in `Rails.application.secrets`,
488
491
  which is deprecated in favor of `Rails.application.credentials` and
489
492
  will be removed in Rails 7.2.
490
493
  MSG
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
@@ -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?)
@@ -9,7 +9,7 @@ module Rails
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 1
12
- TINY = 2
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
@@ -543,6 +543,7 @@ module Rails
543
543
 
544
544
  public_task :apply_rails_template
545
545
  public_task :run_bundle
546
+ public_task :add_bundler_platforms
546
547
  public_task :generate_bundler_binstub
547
548
  public_task :run_javascript
548
549
  public_task :run_hotwire
@@ -29,7 +29,7 @@ Rails.application.configure do
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")
@@ -15,8 +15,9 @@
15
15
  #
16
16
  # This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size
17
17
  # of the bootsnap cache if you use it.
18
- #++
19
- # 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
20
21
 
21
22
  ###
22
23
  # Remove the default X-Download-Options headers since it is used only by Internet Explorer.
@@ -38,7 +39,7 @@
38
39
 
39
40
  ###
40
41
  # Active Record Encryption now uses SHA-256 as its hash digest algorithm.
41
- #
42
+ #
42
43
  # There are 3 scenarios to consider.
43
44
  #
44
45
  # 1. If you have data encrypted with previous Rails versions, and you have
@@ -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
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.2
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-11-10 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.2
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.2
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.2
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.2
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.2
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.2
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:
@@ -459,10 +459,10 @@ licenses:
459
459
  - MIT
460
460
  metadata:
461
461
  bug_tracker_uri: https://github.com/rails/rails/issues
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/
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/
464
464
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
465
- source_code_uri: https://github.com/rails/rails/tree/v7.1.2/railties
465
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.3/railties
466
466
  rubygems_mfa_required: 'true'
467
467
  post_install_message:
468
468
  rdoc_options: