railties 7.2.2.2 → 7.2.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: 8009fa588f07cda8a4b7c679458e6c63c086752e0705a86b655a40839f939e9f
4
- data.tar.gz: 7924907690eeb96418682545eb00365039b467768829e73148c0ac88283b6704
3
+ metadata.gz: 03707d5a40324d24b583b991da92609ad85de44f8c3a6bb04f03b0281916b6e2
4
+ data.tar.gz: a8bef9574493a2ee9cafcb97558267c8b48a6c63038c0198d2e5c815bb4801fd
5
5
  SHA512:
6
- metadata.gz: ab68f603242dc368dd9463696055540f3c934f0b2c0e0c59aacdc4bf1407b785cce046a6cd1c058707102942df886c6cef29ac278c47cc51b276ccf485b375b5
7
- data.tar.gz: 971f1611acc1d4aead3a199ecffab02c5e72bfbf716565c254cb6bda21c0ce0520ae4e9950756f408eb7afce173701d3495d2868b49599abaf0c039f03b66f24
6
+ metadata.gz: 2d3f02e3af390201315588a8e8b8ff1aae3356c97d634f61ab99cdd6c627e525014ea9781fb406b7d89d70b33b3446e6235c4f0e7bd9d508bf5690511ae4af31
7
+ data.tar.gz: 1e931d3f0d663841df219a0a2d17ee4abadf4b5f785e2747cff8012738dad6e7a57e4c7c40c8f21002b1d36ccd342c2e821a9644a3a3074606beaa18bff4446d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## Rails 7.2.3 (October 28, 2025) ##
2
+
3
+ * Use `secret_key_base` from ENV or credentials when present locally.
4
+
5
+ When ENV["SECRET_KEY_BASE"] or
6
+ `Rails.application.credentials.secret_key_base` is set for test or
7
+ development, it is used for the `Rails.config.secret_key_base`,
8
+ instead of generating a `tmp/local_secret.txt` file.
9
+
10
+ *Petrik de Heus*
11
+
12
+
1
13
  ## Rails 7.2.2.2 (August 13, 2025) ##
2
14
 
3
15
  * No changes.
data/README.rdoc CHANGED
@@ -34,6 +34,6 @@ Bug reports can be filed for the Ruby on \Rails project here:
34
34
 
35
35
  * https://github.com/rails/rails/issues
36
36
 
37
- Feature requests should be discussed on the rails-core mailing list here:
37
+ Feature requests should be discussed on the rubyonrails-core forum here:
38
38
 
39
39
  * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -25,7 +25,7 @@ module Minitest
25
25
  end
26
26
  end
27
27
 
28
- class ProfileReporter < StatisticsReporter
28
+ class ProfileReporter < Reporter
29
29
  def initialize(io = $stdout, options = {})
30
30
  super
31
31
  @results = []
@@ -60,9 +60,7 @@ module Rails
60
60
  end
61
61
  else
62
62
  Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
63
- broadcast_logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
64
- broadcast_logger.formatter = Rails.logger.formatter
65
- Rails.logger = broadcast_logger
63
+ Rails.logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
66
64
  end
67
65
  end
68
66
 
@@ -500,16 +500,18 @@ module Rails
500
500
 
501
501
  def secret_key_base
502
502
  @secret_key_base || begin
503
- self.secret_key_base = if generate_local_secret?
503
+ self.secret_key_base = if ENV["SECRET_KEY_BASE_DUMMY"]
504
504
  generate_local_secret
505
505
  else
506
- ENV["SECRET_KEY_BASE"] || Rails.application.credentials.secret_key_base
506
+ ENV["SECRET_KEY_BASE"] ||
507
+ Rails.application.credentials.secret_key_base ||
508
+ (Rails.env.local? && generate_local_secret)
507
509
  end
508
510
  end
509
511
  end
510
512
 
511
513
  def secret_key_base=(new_secret_key_base)
512
- if new_secret_key_base.nil? && generate_local_secret?
514
+ if new_secret_key_base.nil? && Rails.env.local?
513
515
  @secret_key_base = generate_local_secret
514
516
  elsif new_secret_key_base.is_a?(String) && new_secret_key_base.present?
515
517
  @secret_key_base = new_secret_key_base
@@ -637,10 +639,6 @@ module Rails
637
639
 
638
640
  File.binread(key_file)
639
641
  end
640
-
641
- def generate_local_secret?
642
- Rails.env.local? || ENV["SECRET_KEY_BASE_DUMMY"]
643
- end
644
642
  end
645
643
  end
646
644
  end
@@ -454,18 +454,21 @@ module Rails
454
454
  # is used to create all ActiveSupport::MessageVerifier and ActiveSupport::MessageEncryptor instances,
455
455
  # including the ones that sign and encrypt cookies.
456
456
  #
457
- # In development and test, this is randomly generated and stored in a
458
- # temporary file in <tt>tmp/local_secret.txt</tt>.
457
+ # We look for it first in <tt>ENV["SECRET_KEY_BASE"]</tt>, then in
458
+ # +credentials.secret_key_base+. For most applications, the correct place
459
+ # to store it is in the encrypted credentials file.
459
460
  #
460
- # You can also set <tt>ENV["SECRET_KEY_BASE_DUMMY"]</tt> to trigger the use of a randomly generated
461
- # secret_key_base that's stored in a temporary file. This is useful when precompiling assets for
462
- # production as part of a build step that otherwise does not need access to the production secrets.
461
+ # In development and test, if the secret_key_base is still empty, it is
462
+ # randomly generated and stored in a temporary file in
463
+ # <tt>tmp/local_secret.txt</tt>.
463
464
  #
464
- # Dockerfile example: <tt>RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile</tt>.
465
+ # Generating a random secret_key_base and storing it in
466
+ # <tt>tmp/local_secret.txt</tt> can also be triggered by setting
467
+ # <tt>ENV["SECRET_KEY_BASE_DUMMY"]</tt>. This is useful when precompiling
468
+ # assets for production as part of a build step that otherwise does not
469
+ # need access to the production secrets.
465
470
  #
466
- # In all other environments, we look for it first in <tt>ENV["SECRET_KEY_BASE"]</tt>,
467
- # then +credentials.secret_key_base+. For most applications, the correct place to store it is in the
468
- # encrypted credentials file.
471
+ # Dockerfile example: <tt>RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile</tt>.
469
472
  def secret_key_base
470
473
  config.secret_key_base
471
474
  end
@@ -5,7 +5,7 @@ require "active_support/core_ext/string/access"
5
5
 
6
6
  module Rails
7
7
  class BacktraceCleaner < ActiveSupport::BacktraceCleaner # :nodoc:
8
- APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/
8
+ APP_DIRS_PATTERN = /\A(?:\.\/)?(?:app|config|lib|test|\(\w+(?:-\w+)*\))/
9
9
  RENDER_TEMPLATE_PATTERN = /:in [`'].*_\w+_{2,3}\d+_\d+'/
10
10
 
11
11
  def initialize
@@ -60,24 +60,11 @@ module Rails
60
60
  end
61
61
  end
62
62
 
63
- class ReloadCommand < IRB::Command::Base
64
- include ConsoleMethods
65
-
66
- category "Rails console"
67
- description "Reloads the Rails application."
68
-
69
- def execute(*)
70
- puts "Reloading..."
71
- Rails.application.reloader.reload!
72
- end
73
- end
74
-
75
63
  IRB::HelperMethod.register(:helper, ControllerHelper)
76
64
  IRB::HelperMethod.register(:controller, ControllerInstance)
77
65
  IRB::HelperMethod.register(:new_session, NewSession)
78
66
  IRB::HelperMethod.register(:app, AppInstance)
79
67
  IRB::HelperMethod.register(:reload!, ReloadHelper)
80
- IRB::Command.register(:reload!, ReloadCommand)
81
68
 
82
69
  class IRBConsole
83
70
  def initialize(app)
@@ -31,8 +31,6 @@ module Rails
31
31
  Rails::TestUnit::Runner.parse_options(args)
32
32
  run_prepare_task if self.args.none?(EXACT_TEST_ARGUMENT_PATTERN)
33
33
  Rails::TestUnit::Runner.run(args)
34
- rescue Rails::TestUnit::InvalidTestError => error
35
- raise ArgumentError, error.message
36
34
  end
37
35
 
38
36
  # Define Thor tasks to avoid going through Rake and booting twice when using bin/rails test:*
@@ -9,8 +9,8 @@ module Rails
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 2
12
- TINY = 2
13
- PRE = "2"
12
+ TINY = 3
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -445,8 +445,8 @@ module Rails
445
445
 
446
446
  private
447
447
  # Define log for backwards compatibility. If just one argument is sent,
448
- # invoke say, otherwise invoke say_status. Differently from say and
449
- # similarly to say_status, this method respects the quiet? option given.
448
+ # invoke +say+, otherwise invoke +say_status+. Differently from +say+ and
449
+ # similarly to +say_status+, this method respects the +quiet?+ option given.
450
450
  def log(*args) # :doc:
451
451
  if args.size == 1
452
452
  say args.first.to_s unless options.quiet?
@@ -456,7 +456,7 @@ module Rails
456
456
  end
457
457
  end
458
458
 
459
- # Runs the supplied command using either "rake ..." or "rails ..."
459
+ # Runs the supplied command using either +rake+ or +rails+
460
460
  # based on the executor parameter provided.
461
461
  def execute_command(executor, command, options = {}) # :doc:
462
462
  log executor, command
@@ -490,12 +490,16 @@ module Rails
490
490
  end
491
491
  alias rebase_indentation optimize_indentation
492
492
 
493
- # Indent the +Gemfile+ to the depth of @indentation
493
+ # Returns a string corresponding to the current indentation level
494
+ # (i.e. 2 * <code>@indentation</code> spaces). See also
495
+ # #with_indentation, which can be used to manage the indentation level.
494
496
  def indentation # :doc:
495
497
  " " * @indentation
496
498
  end
497
499
 
498
- # Manage +Gemfile+ indentation for a DSL action block
500
+ # Increases the current indentation indentation level for the duration
501
+ # of the given block, and decreases it after the block ends. Call
502
+ # #indentation to get an indentation string.
499
503
  def with_indentation(&block) # :doc:
500
504
  @indentation += 1
501
505
  instance_eval(&block)
@@ -589,7 +589,7 @@ module Rails
589
589
 
590
590
  def dockerfile_build_packages
591
591
  # start with the essentials
592
- packages = %w(build-essential git pkg-config)
592
+ packages = %w(build-essential git pkg-config libyaml-dev)
593
593
 
594
594
  # add database support
595
595
  packages << database.build_package unless skip_active_record?
@@ -665,7 +665,7 @@ module Rails
665
665
  end
666
666
 
667
667
  def depend_on_bootsnap?
668
- !options[:skip_bootsnap] && !options[:dev] && !defined?(JRUBY_VERSION)
668
+ !options[:skip_bootsnap] && !options[:dev] && !jruby?
669
669
  end
670
670
 
671
671
  def target_rails_prerelease(self_command = "new")
@@ -722,7 +722,7 @@ module Rails
722
722
  end
723
723
 
724
724
  def add_bundler_platforms
725
- if bundle_install?
725
+ if bundle_install? && !jruby?
726
726
  # The vast majority of Rails apps will be deployed on `x86_64-linux`.
727
727
  bundle_command("lock --add-platform=x86_64-linux")
728
728
 
@@ -731,6 +731,10 @@ module Rails
731
731
  end
732
732
  end
733
733
 
734
+ def jruby?
735
+ defined?(JRUBY_VERSION)
736
+ end
737
+
734
738
  def generate_bundler_binstub
735
739
  if bundle_install?
736
740
  bundle_command("binstubs bundler")
@@ -120,8 +120,10 @@ jobs:
120
120
  - name: Run tests
121
121
  env:
122
122
  RAILS_ENV: test
123
- <%- if options[:database] == "mysql" || options[:database] == "trilogy" -%>
123
+ <%- if options[:database] == "mysql" -%>
124
124
  DATABASE_URL: mysql2://127.0.0.1:3306
125
+ <%- elsif options[:database] == "trilogy" -%>
126
+ DATABASE_URL: trilogy://127.0.0.1:3306
125
127
  <%- elsif options[:database] == "postgresql" -%>
126
128
  DATABASE_URL: postgres://postgres:postgres@localhost:5432
127
129
  <%- end -%>
@@ -84,8 +84,10 @@ jobs:
84
84
  - name: Run tests
85
85
  env:
86
86
  RAILS_ENV: test
87
- <%- if options[:database] == "mysql" || options[:database] == "trilogy" -%>
87
+ <%- if options[:database] == "mysql" -%>
88
88
  DATABASE_URL: mysql2://127.0.0.1:3306
89
+ <%- elsif options[:database] == "trilogy" -%>
90
+ DATABASE_URL: trilogy://127.0.0.1:3306
89
91
  <%- elsif options[:database] == "postgresql" -%>
90
92
  DATABASE_URL: postgres://postgres:postgres@localhost:5432
91
93
  <%- end -%>
@@ -100,4 +102,3 @@ jobs:
100
102
  path: ${{ github.workspace }}/tmp/screenshots
101
103
  if-no-files-found: ignore
102
104
  <% end -%>
103
-
@@ -21,7 +21,7 @@ class <%= controller_class_name %>Controller < ApplicationController
21
21
  if @<%= orm_instance.save %>
22
22
  render json: <%= "@#{singular_table_name}" %>, status: :created, location: <%= "@#{singular_table_name}" %>
23
23
  else
24
- render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity
24
+ render json: <%= "@#{orm_instance.errors}" %>, status: <%= ActionDispatch::Constants::UNPROCESSABLE_CONTENT.inspect %>
25
25
  end
26
26
  end
27
27
 
@@ -30,7 +30,7 @@ class <%= controller_class_name %>Controller < ApplicationController
30
30
  if @<%= orm_instance.update("#{singular_table_name}_params") %>
31
31
  render json: <%= "@#{singular_table_name}" %>
32
32
  else
33
- render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity
33
+ render json: <%= "@#{orm_instance.errors}" %>, status: <%= ActionDispatch::Constants::UNPROCESSABLE_CONTENT.inspect %>
34
34
  end
35
35
  end
36
36
 
@@ -27,7 +27,7 @@ class <%= controller_class_name %>Controller < ApplicationController
27
27
  if @<%= orm_instance.save %>
28
28
  redirect_to <%= redirect_resource_name %>, notice: <%= %("#{human_name} was successfully created.") %>
29
29
  else
30
- render :new, status: :unprocessable_entity
30
+ render :new, status: <%= ActionDispatch::Constants::UNPROCESSABLE_CONTENT.inspect %>
31
31
  end
32
32
  end
33
33
 
@@ -36,7 +36,7 @@ class <%= controller_class_name %>Controller < ApplicationController
36
36
  if @<%= orm_instance.update("#{singular_table_name}_params") %>
37
37
  redirect_to <%= redirect_resource_name %>, notice: <%= %("#{human_name} was successfully updated.") %>, status: :see_other
38
38
  else
39
- render :edit, status: :unprocessable_entity
39
+ render :edit, status: <%= ActionDispatch::Constants::UNPROCESSABLE_CONTENT.inspect %>
40
40
  end
41
41
  end
42
42
 
@@ -97,11 +97,11 @@ module Rails
97
97
  # generator group to fall back to another group in case of missing generators,
98
98
  # they can add a fallback.
99
99
  #
100
- # For example, shoulda is considered a test_framework and is an extension
101
- # of test_unit. However, most part of shoulda generators are similar to
102
- # test_unit ones.
100
+ # For example, shoulda is considered a +test_framework+ and is an extension
101
+ # of +test_unit+. However, most part of shoulda generators are similar to
102
+ # +test_unit+ ones.
103
103
  #
104
- # Shoulda then can tell generators to search for test_unit generators when
104
+ # Shoulda then can tell generators to search for +test_unit+ generators when
105
105
  # some of them are not available by adding a fallback:
106
106
  #
107
107
  # Rails::Generators.fallbacks[:shoulda] = :test_unit
@@ -316,7 +316,7 @@ module Rails
316
316
 
317
317
  def run_after_generate_callback
318
318
  if defined?(@@generated_files) && !@@generated_files.empty?
319
- @after_generate_callbacks.each do |callback|
319
+ after_generate_callbacks.each do |callback|
320
320
  callback.call(@@generated_files)
321
321
  end
322
322
  @@generated_files = []
@@ -9,13 +9,17 @@ require "rails/test_unit/test_parser"
9
9
 
10
10
  module Rails
11
11
  module TestUnit
12
- class InvalidTestError < StandardError
12
+ class InvalidTestError < ArgumentError
13
13
  def initialize(path, suggestion)
14
- super(<<~MESSAGE.squish)
14
+ super(<<~MESSAGE.rstrip)
15
15
  Could not load test file: #{path}.
16
16
  #{suggestion}
17
17
  MESSAGE
18
18
  end
19
+
20
+ def backtrace(*args)
21
+ []
22
+ end
19
23
  end
20
24
 
21
25
  class Runner
@@ -68,7 +72,7 @@ module Rails
68
72
  if corrections.empty?
69
73
  raise exception
70
74
  end
71
- raise InvalidTestError.new(path, DidYouMean::Formatter.message_for(corrections))
75
+ raise(InvalidTestError.new(path, DidYouMean::Formatter.message_for(corrections)), cause: nil)
72
76
  else
73
77
  raise
74
78
  end
@@ -13,29 +13,32 @@ if defined?(Prism)
13
13
  # Parse a test file to extract the line ranges of all tests in both
14
14
  # method-style (def test_foo) and declarative-style (test "foo" do)
15
15
  module TestParser
16
+ @begins_to_ends = {}
16
17
  # Helper to translate a method object into the path and line range where
17
18
  # the method was defined.
18
19
  def self.definition_for(method)
19
20
  filepath, start_line = method.source_location
20
- queue = [Prism.parse_file(filepath).value]
21
+ @begins_to_ends[filepath] ||= ranges(filepath)
22
+ return unless end_line = @begins_to_ends[filepath][start_line]
23
+ [filepath, start_line..end_line]
24
+ end
21
25
 
22
- while (node = queue.shift)
23
- case node.type
24
- when :def_node
25
- if node.location.start_line == start_line
26
- return [filepath, start_line..node.location.end_line]
26
+ private
27
+ def self.ranges(filepath)
28
+ queue = [Prism.parse_file(filepath).value]
29
+ begins_to_ends = {}
30
+ while (node = queue.shift)
31
+ case node.type
32
+ when :def_node
33
+ begins_to_ends[node.location.start_line] = node.location.end_line
34
+ when :call_node
35
+ begins_to_ends[node.location.start_line] = node.location.end_line
27
36
  end
28
- when :call_node
29
- if node.location.start_line == start_line
30
- return [filepath, start_line..node.location.end_line]
31
- end
32
- end
33
37
 
34
- queue.concat(node.compact_child_nodes)
38
+ queue.concat(node.compact_child_nodes)
39
+ end
40
+ begins_to_ends
35
41
  end
36
-
37
- nil
38
- end
39
42
  end
40
43
  end
41
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railties
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.2.2
4
+ version: 7.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,28 +15,42 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 7.2.2.2
18
+ version: 7.2.3
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 7.2.2.2
25
+ version: 7.2.3
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: actionpack
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - '='
31
31
  - !ruby/object:Gem::Version
32
- version: 7.2.2.2
32
+ version: 7.2.3
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 7.2.2.2
39
+ version: 7.2.3
40
+ - !ruby/object:Gem::Dependency
41
+ name: cgi
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
40
54
  - !ruby/object:Gem::Dependency
41
55
  name: rackup
42
56
  requirement: !ruby/object:Gem::Requirement
@@ -113,20 +127,34 @@ dependencies:
113
127
  - - "~>"
114
128
  - !ruby/object:Gem::Version
115
129
  version: '1.13'
130
+ - !ruby/object:Gem::Dependency
131
+ name: tsort
132
+ requirement: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0.2'
137
+ type: :runtime
138
+ prerelease: false
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0.2'
116
144
  - !ruby/object:Gem::Dependency
117
145
  name: actionview
118
146
  requirement: !ruby/object:Gem::Requirement
119
147
  requirements:
120
148
  - - '='
121
149
  - !ruby/object:Gem::Version
122
- version: 7.2.2.2
150
+ version: 7.2.3
123
151
  type: :development
124
152
  prerelease: false
125
153
  version_requirements: !ruby/object:Gem::Requirement
126
154
  requirements:
127
155
  - - '='
128
156
  - !ruby/object:Gem::Version
129
- version: 7.2.2.2
157
+ version: 7.2.3
130
158
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
131
159
  email: david@loudthinking.com
132
160
  executables:
@@ -468,10 +496,10 @@ licenses:
468
496
  - MIT
469
497
  metadata:
470
498
  bug_tracker_uri: https://github.com/rails/rails/issues
471
- changelog_uri: https://github.com/rails/rails/blob/v7.2.2.2/railties/CHANGELOG.md
472
- documentation_uri: https://api.rubyonrails.org/v7.2.2.2/
499
+ changelog_uri: https://github.com/rails/rails/blob/v7.2.3/railties/CHANGELOG.md
500
+ documentation_uri: https://api.rubyonrails.org/v7.2.3/
473
501
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
474
- source_code_uri: https://github.com/rails/rails/tree/v7.2.2.2/railties
502
+ source_code_uri: https://github.com/rails/rails/tree/v7.2.3/railties
475
503
  rubygems_mfa_required: 'true'
476
504
  rdoc_options:
477
505
  - "--exclude"