railties 7.2.1 → 7.2.3.1
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 +4 -4
- data/CHANGELOG.md +42 -0
- data/README.rdoc +1 -1
- data/lib/minitest/rails_plugin.rb +1 -1
- data/lib/rails/application/bootstrap.rb +1 -3
- data/lib/rails/application/configuration.rb +5 -7
- data/lib/rails/application.rb +12 -9
- data/lib/rails/backtrace_cleaner.rb +1 -1
- data/lib/rails/commands/console/irb_console.rb +3 -6
- data/lib/rails/commands/test/test_command.rb +0 -2
- data/lib/rails/engine.rb +2 -2
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators/actions.rb +9 -5
- data/lib/rails/generators/app_base.rb +7 -3
- data/lib/rails/generators/rails/app/app_generator.rb +0 -4
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +4 -2
- data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +1 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +4 -2
- data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +4 -3
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +2 -2
- data/lib/rails/generators.rb +11 -7
- data/lib/rails/info_controller.rb +4 -2
- data/lib/rails/railtie.rb +13 -13
- data/lib/rails/test_unit/runner.rb +7 -3
- data/lib/rails/test_unit/test_parser.rb +18 -15
- metadata +40 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6901f0b92ef11f501dfc346db6917e4f8c5612cfe69dcf286b2fe34c7984d00d
|
|
4
|
+
data.tar.gz: fc0584d1aa4d6a4900ccbaa846eef834deb35a96e253c0fb3abc47e9216f5ffe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 105b31ef811832df283f6b185b0e2a3277023e949ed32b45bfb64ff99733df720c74b60b83d38679411069a52671f0df1b46add11385219f610c13a9894e2446
|
|
7
|
+
data.tar.gz: ef33b6491ada406372baa50d9e1f5ea70e0cae44abca697bea78748610109eca8e91fb68b077c1a5b55e5388f1d7108d78812b4d29da0b8f88143fd93da0f2e3
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
## Rails 7.2.3.1 (March 23, 2026) ##
|
|
2
|
+
|
|
3
|
+
* No changes.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Rails 7.2.3 (October 28, 2025) ##
|
|
7
|
+
|
|
8
|
+
* Use `secret_key_base` from ENV or credentials when present locally.
|
|
9
|
+
|
|
10
|
+
When ENV["SECRET_KEY_BASE"] or
|
|
11
|
+
`Rails.application.credentials.secret_key_base` is set for test or
|
|
12
|
+
development, it is used for the `Rails.config.secret_key_base`,
|
|
13
|
+
instead of generating a `tmp/local_secret.txt` file.
|
|
14
|
+
|
|
15
|
+
*Petrik de Heus*
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Rails 7.2.2.2 (August 13, 2025) ##
|
|
19
|
+
|
|
20
|
+
* No changes.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Rails 7.2.2.1 (December 10, 2024) ##
|
|
24
|
+
|
|
25
|
+
* No changes.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Rails 7.2.2 (October 30, 2024) ##
|
|
29
|
+
|
|
30
|
+
* No changes.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Rails 7.2.1.2 (October 23, 2024) ##
|
|
34
|
+
|
|
35
|
+
* No changes.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Rails 7.2.1.1 (October 15, 2024) ##
|
|
39
|
+
|
|
40
|
+
* No changes.
|
|
41
|
+
|
|
42
|
+
|
|
1
43
|
## Rails 7.2.1 (August 22, 2024) ##
|
|
2
44
|
|
|
3
45
|
* Fix `rails console` for application with non default application constant.
|
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
|
|
37
|
+
Feature requests should be discussed on the rubyonrails-core forum here:
|
|
38
38
|
|
|
39
39
|
* https://discuss.rubyonrails.org/c/rubyonrails-core
|
|
@@ -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
|
-
|
|
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
|
|
503
|
+
self.secret_key_base = if ENV["SECRET_KEY_BASE_DUMMY"]
|
|
504
504
|
generate_local_secret
|
|
505
505
|
else
|
|
506
|
-
ENV["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? &&
|
|
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
|
data/lib/rails/application.rb
CHANGED
|
@@ -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
|
-
#
|
|
458
|
-
#
|
|
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
|
-
#
|
|
461
|
-
#
|
|
462
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
|
@@ -51,13 +51,10 @@ module Rails
|
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
class
|
|
55
|
-
include ConsoleMethods
|
|
56
|
-
|
|
57
|
-
category "Rails console"
|
|
54
|
+
class ReloadHelper < RailsHelperBase
|
|
58
55
|
description "Reloads the Rails application."
|
|
59
56
|
|
|
60
|
-
def execute
|
|
57
|
+
def execute
|
|
61
58
|
puts "Reloading..."
|
|
62
59
|
Rails.application.reloader.reload!
|
|
63
60
|
end
|
|
@@ -67,7 +64,7 @@ module Rails
|
|
|
67
64
|
IRB::HelperMethod.register(:controller, ControllerInstance)
|
|
68
65
|
IRB::HelperMethod.register(:new_session, NewSession)
|
|
69
66
|
IRB::HelperMethod.register(:app, AppInstance)
|
|
70
|
-
IRB::
|
|
67
|
+
IRB::HelperMethod.register(:reload!, ReloadHelper)
|
|
71
68
|
|
|
72
69
|
class IRBConsole
|
|
73
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:*
|
data/lib/rails/engine.rb
CHANGED
|
@@ -643,9 +643,9 @@ module Rails
|
|
|
643
643
|
end
|
|
644
644
|
end
|
|
645
645
|
|
|
646
|
-
initializer :
|
|
646
|
+
initializer :wrap_reloader_around_load_seed do |app|
|
|
647
647
|
self.class.set_callback(:load_seed, :around) do |engine, seeds_block|
|
|
648
|
-
app.
|
|
648
|
+
app.reloader.wrap(&seeds_block)
|
|
649
649
|
end
|
|
650
650
|
end
|
|
651
651
|
|
data/lib/rails/gem_version.rb
CHANGED
|
@@ -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
|
|
449
|
-
# similarly to say_status
|
|
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
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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] && !
|
|
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")
|
|
@@ -286,10 +286,6 @@ module Rails
|
|
|
286
286
|
end
|
|
287
287
|
|
|
288
288
|
module Generators
|
|
289
|
-
# We need to store the RAILS_DEV_PATH in a constant, otherwise the path
|
|
290
|
-
# can change in Ruby 1.8.7 when we FileUtils.cd.
|
|
291
|
-
RAILS_DEV_PATH = File.expand_path("../../../../../..", __dir__)
|
|
292
|
-
|
|
293
289
|
class AppGenerator < AppBase
|
|
294
290
|
# :stopdoc:
|
|
295
291
|
|
|
@@ -54,7 +54,7 @@ group :development do
|
|
|
54
54
|
<%- if RUBY_VERSION < "3.2" -%>
|
|
55
55
|
|
|
56
56
|
# Highlight the fine-grained location where an error occurred [https://github.com/ruby/error_highlight]
|
|
57
|
-
gem "error_highlight", ">= 0.4.0", platforms: [:ruby]
|
|
57
|
+
gem "error_highlight", ">= 0.4.0", platforms: [ :ruby ]
|
|
58
58
|
<%- end -%>
|
|
59
59
|
end
|
|
60
60
|
<%- end -%>
|
|
@@ -104,6 +104,9 @@ Rails.application.configure do
|
|
|
104
104
|
|
|
105
105
|
# Do not dump schema after migrations.
|
|
106
106
|
config.active_record.dump_schema_after_migration = false
|
|
107
|
+
|
|
108
|
+
# Only use :id for inspections in production.
|
|
109
|
+
config.active_record.attributes_for_inspect = [ :id ]
|
|
107
110
|
<%- end -%>
|
|
108
111
|
|
|
109
112
|
# Enable DNS rebinding protection and other `Host` header attacks.
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
run: bin/brakeman --no-pager
|
|
25
25
|
|
|
26
26
|
<% end -%>
|
|
27
|
-
<%- if options[:javascript] == "importmap" -%>
|
|
27
|
+
<%- if options[:javascript] == "importmap" && !options[:api] -%>
|
|
28
28
|
scan_js:
|
|
29
29
|
runs-on: ubuntu-latest
|
|
30
30
|
|
|
@@ -120,8 +120,10 @@ jobs:
|
|
|
120
120
|
- name: Run tests
|
|
121
121
|
env:
|
|
122
122
|
RAILS_ENV: test
|
|
123
|
-
<%- if options[:database] == "mysql"
|
|
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 -%>
|
|
@@ -491,9 +491,11 @@ module Rails
|
|
|
491
491
|
|
|
492
492
|
def test_command
|
|
493
493
|
if engine? && !options[:skip_active_record] && with_dummy_app?
|
|
494
|
-
"db:test:prepare test"
|
|
494
|
+
"bin/rails db:test:prepare test"
|
|
495
|
+
elsif engine?
|
|
496
|
+
"bin/rails test"
|
|
495
497
|
else
|
|
496
|
-
"test"
|
|
498
|
+
"bin/test"
|
|
497
499
|
end
|
|
498
500
|
end
|
|
499
501
|
end
|
|
@@ -84,13 +84,15 @@ jobs:
|
|
|
84
84
|
- name: Run tests
|
|
85
85
|
env:
|
|
86
86
|
RAILS_ENV: test
|
|
87
|
-
<%- if options[:database] == "mysql"
|
|
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 -%>
|
|
92
94
|
# REDIS_URL: redis://localhost:6379/0
|
|
93
|
-
run:
|
|
95
|
+
run: <%= test_command %>
|
|
94
96
|
|
|
95
97
|
- name: Keep screenshots from failed system tests
|
|
96
98
|
uses: actions/upload-artifact@v4
|
|
@@ -100,4 +102,3 @@ jobs:
|
|
|
100
102
|
path: ${{ github.workspace }}/tmp/screenshots
|
|
101
103
|
if-no-files-found: ignore
|
|
102
104
|
<% end -%>
|
|
103
|
-
|
|
@@ -3,7 +3,7 @@ ENV["RAILS_ENV"] = "test"
|
|
|
3
3
|
|
|
4
4
|
require_relative "<%= File.join("..", options[:dummy_path], "config/environment") -%>"
|
|
5
5
|
<% unless options[:skip_active_record] -%>
|
|
6
|
-
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../<%= options[:dummy_path] -%>/db/migrate", __dir__)]
|
|
6
|
+
ActiveRecord::Migrator.migrations_paths = [ File.expand_path("../<%= options[:dummy_path] -%>/db/migrate", __dir__) ]
|
|
7
7
|
<% if options[:mountable] -%>
|
|
8
8
|
ActiveRecord::Migrator.migrations_paths << File.expand_path("../db/migrate", __dir__)
|
|
9
9
|
<% end -%>
|
|
@@ -13,7 +13,7 @@ require "rails/test_help"
|
|
|
13
13
|
<% unless options[:skip_active_record] -%>
|
|
14
14
|
# Load fixtures from the engine
|
|
15
15
|
if ActiveSupport::TestCase.respond_to?(:fixture_paths=)
|
|
16
|
-
ActiveSupport::TestCase.fixture_paths = [File.expand_path("fixtures", __dir__)]
|
|
16
|
+
ActiveSupport::TestCase.fixture_paths = [ File.expand_path("fixtures", __dir__) ]
|
|
17
17
|
ActionDispatch::IntegrationTest.fixture_paths = ActiveSupport::TestCase.fixture_paths
|
|
18
18
|
ActiveSupport::TestCase.file_fixture_path = File.expand_path("fixtures", __dir__) + "/files"
|
|
19
19
|
ActiveSupport::TestCase.fixtures :all
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
39
|
+
render :edit, status: <%= ActionDispatch::Constants::UNPROCESSABLE_CONTENT.inspect %>
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
data/lib/rails/generators.rb
CHANGED
|
@@ -23,7 +23,6 @@ module Rails
|
|
|
23
23
|
autoload :NamedBase, "rails/generators/named_base"
|
|
24
24
|
autoload :ResourceHelpers, "rails/generators/resource_helpers"
|
|
25
25
|
autoload :TestCase, "rails/generators/test_case"
|
|
26
|
-
autoload :Devcontainer, "rails/generators/devcontainer"
|
|
27
26
|
|
|
28
27
|
mattr_accessor :namespace
|
|
29
28
|
|
|
@@ -61,6 +60,10 @@ module Rails
|
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
|
|
63
|
+
# We need to store the RAILS_DEV_PATH in a constant, otherwise the path
|
|
64
|
+
# can change when we FileUtils.cd.
|
|
65
|
+
RAILS_DEV_PATH = File.expand_path("../../..", __dir__) # :nodoc:
|
|
66
|
+
|
|
64
67
|
class << self
|
|
65
68
|
def configure!(config) # :nodoc:
|
|
66
69
|
api_only! if config.api_only
|
|
@@ -94,11 +97,11 @@ module Rails
|
|
|
94
97
|
# generator group to fall back to another group in case of missing generators,
|
|
95
98
|
# they can add a fallback.
|
|
96
99
|
#
|
|
97
|
-
# For example, shoulda is considered a test_framework and is an extension
|
|
98
|
-
# of test_unit
|
|
99
|
-
# 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.
|
|
100
103
|
#
|
|
101
|
-
# 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
|
|
102
105
|
# some of them are not available by adding a fallback:
|
|
103
106
|
#
|
|
104
107
|
# Rails::Generators.fallbacks[:shoulda] = :test_unit
|
|
@@ -152,7 +155,8 @@ module Rails
|
|
|
152
155
|
"#{template}:scaffold",
|
|
153
156
|
"#{template}:mailer",
|
|
154
157
|
"action_text:install",
|
|
155
|
-
"action_mailbox:install"
|
|
158
|
+
"action_mailbox:install",
|
|
159
|
+
"devcontainer"
|
|
156
160
|
]
|
|
157
161
|
end
|
|
158
162
|
end
|
|
@@ -312,7 +316,7 @@ module Rails
|
|
|
312
316
|
|
|
313
317
|
def run_after_generate_callback
|
|
314
318
|
if defined?(@@generated_files) && !@@generated_files.empty?
|
|
315
|
-
|
|
319
|
+
after_generate_callbacks.each do |callback|
|
|
316
320
|
callback.call(@@generated_files)
|
|
317
321
|
end
|
|
318
322
|
@@generated_files = []
|
|
@@ -7,6 +7,8 @@ class Rails::InfoController < Rails::ApplicationController # :nodoc:
|
|
|
7
7
|
prepend_view_path ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS
|
|
8
8
|
layout -> { request.xhr? ? false : "application" }
|
|
9
9
|
|
|
10
|
+
RFC2396_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
|
|
11
|
+
|
|
10
12
|
before_action :require_local!
|
|
11
13
|
|
|
12
14
|
def index
|
|
@@ -20,7 +22,7 @@ class Rails::InfoController < Rails::ApplicationController # :nodoc:
|
|
|
20
22
|
|
|
21
23
|
def routes
|
|
22
24
|
if query = params[:query]
|
|
23
|
-
query =
|
|
25
|
+
query = RFC2396_PARSER.escape query
|
|
24
26
|
|
|
25
27
|
render json: {
|
|
26
28
|
exact: matching_routes(query: query, exact_match: true),
|
|
@@ -53,7 +55,7 @@ class Rails::InfoController < Rails::ApplicationController # :nodoc:
|
|
|
53
55
|
match ||= (query === route_wrapper.verb)
|
|
54
56
|
|
|
55
57
|
unless match
|
|
56
|
-
controller_action =
|
|
58
|
+
controller_action = RFC2396_PARSER.escape(route_wrapper.reqs)
|
|
57
59
|
match = exact_match ? (query === controller_action) : controller_action.include?(query)
|
|
58
60
|
end
|
|
59
61
|
|
data/lib/rails/railtie.rb
CHANGED
|
@@ -50,8 +50,8 @@ module Rails
|
|
|
50
50
|
# To add an initialization step to the \Rails boot process from your railtie, just
|
|
51
51
|
# define the initialization code with the +initializer+ macro:
|
|
52
52
|
#
|
|
53
|
-
# class
|
|
54
|
-
# initializer "
|
|
53
|
+
# class MyGem::Railtie < Rails::Railtie
|
|
54
|
+
# initializer "my_gem.configure_rails_initialization" do
|
|
55
55
|
# # some initialization behavior
|
|
56
56
|
# end
|
|
57
57
|
# end
|
|
@@ -59,9 +59,9 @@ module Rails
|
|
|
59
59
|
# If specified, the block can also receive the application object, in case you
|
|
60
60
|
# need to access some application-specific configuration, like middleware:
|
|
61
61
|
#
|
|
62
|
-
# class
|
|
63
|
-
# initializer "
|
|
64
|
-
# app.middleware.use
|
|
62
|
+
# class MyGem::Railtie < Rails::Railtie
|
|
63
|
+
# initializer "my_gem.configure_rails_initialization" do |app|
|
|
64
|
+
# app.middleware.use MyGem::Middleware
|
|
65
65
|
# end
|
|
66
66
|
# end
|
|
67
67
|
#
|
|
@@ -74,14 +74,14 @@ module Rails
|
|
|
74
74
|
# Railties can access a config object which contains configuration shared by all
|
|
75
75
|
# railties and the application:
|
|
76
76
|
#
|
|
77
|
-
# class
|
|
77
|
+
# class MyGem::Railtie < Rails::Railtie
|
|
78
78
|
# # Customize the ORM
|
|
79
|
-
# config.app_generators.orm :
|
|
79
|
+
# config.app_generators.orm :my_gem_orm
|
|
80
80
|
#
|
|
81
81
|
# # Add a to_prepare block which is executed once in production
|
|
82
82
|
# # and before each request in development.
|
|
83
83
|
# config.to_prepare do
|
|
84
|
-
#
|
|
84
|
+
# MyGem.setup!
|
|
85
85
|
# end
|
|
86
86
|
# end
|
|
87
87
|
#
|
|
@@ -90,9 +90,9 @@ module Rails
|
|
|
90
90
|
# If your railtie has Rake tasks, you can tell \Rails to load them through the method
|
|
91
91
|
# +rake_tasks+:
|
|
92
92
|
#
|
|
93
|
-
# class
|
|
93
|
+
# class MyGem::Railtie < Rails::Railtie
|
|
94
94
|
# rake_tasks do
|
|
95
|
-
# load "path/to/
|
|
95
|
+
# load "path/to/my_gem.tasks"
|
|
96
96
|
# end
|
|
97
97
|
# end
|
|
98
98
|
#
|
|
@@ -100,9 +100,9 @@ module Rails
|
|
|
100
100
|
# your generators at a different location, you can specify in your railtie a block which
|
|
101
101
|
# will load them during normal generators lookup:
|
|
102
102
|
#
|
|
103
|
-
# class
|
|
103
|
+
# class MyGem::Railtie < Rails::Railtie
|
|
104
104
|
# generators do
|
|
105
|
-
# require "path/to/
|
|
105
|
+
# require "path/to/my_gem_generator"
|
|
106
106
|
# end
|
|
107
107
|
# end
|
|
108
108
|
#
|
|
@@ -120,7 +120,7 @@ module Rails
|
|
|
120
120
|
# this less confusing for everyone.
|
|
121
121
|
# It can be used like this:
|
|
122
122
|
#
|
|
123
|
-
# class
|
|
123
|
+
# class MyGem::Railtie < Rails::Railtie
|
|
124
124
|
# server do
|
|
125
125
|
# WebpackServer.start
|
|
126
126
|
# end
|
|
@@ -9,13 +9,17 @@ require "rails/test_unit/test_parser"
|
|
|
9
9
|
|
|
10
10
|
module Rails
|
|
11
11
|
module TestUnit
|
|
12
|
-
class InvalidTestError <
|
|
12
|
+
class InvalidTestError < ArgumentError
|
|
13
13
|
def initialize(path, suggestion)
|
|
14
|
-
super(<<~MESSAGE.
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: railties
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.2.1
|
|
4
|
+
version: 7.2.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -16,28 +15,42 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - '='
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 7.2.1
|
|
18
|
+
version: 7.2.3.1
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - '='
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 7.2.1
|
|
25
|
+
version: 7.2.3.1
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: actionpack
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - '='
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 7.2.1
|
|
32
|
+
version: 7.2.3.1
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - '='
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 7.2.1
|
|
39
|
+
version: 7.2.3.1
|
|
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'
|
|
41
54
|
- !ruby/object:Gem::Dependency
|
|
42
55
|
name: rackup
|
|
43
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,20 +127,34 @@ dependencies:
|
|
|
114
127
|
- - "~>"
|
|
115
128
|
- !ruby/object:Gem::Version
|
|
116
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'
|
|
117
144
|
- !ruby/object:Gem::Dependency
|
|
118
145
|
name: actionview
|
|
119
146
|
requirement: !ruby/object:Gem::Requirement
|
|
120
147
|
requirements:
|
|
121
148
|
- - '='
|
|
122
149
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: 7.2.1
|
|
150
|
+
version: 7.2.3.1
|
|
124
151
|
type: :development
|
|
125
152
|
prerelease: false
|
|
126
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
127
154
|
requirements:
|
|
128
155
|
- - '='
|
|
129
156
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: 7.2.1
|
|
157
|
+
version: 7.2.3.1
|
|
131
158
|
description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
|
|
132
159
|
email: david@loudthinking.com
|
|
133
160
|
executables:
|
|
@@ -469,12 +496,11 @@ licenses:
|
|
|
469
496
|
- MIT
|
|
470
497
|
metadata:
|
|
471
498
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
472
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.2.1/railties/CHANGELOG.md
|
|
473
|
-
documentation_uri: https://api.rubyonrails.org/v7.2.1/
|
|
499
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.2.3.1/railties/CHANGELOG.md
|
|
500
|
+
documentation_uri: https://api.rubyonrails.org/v7.2.3.1/
|
|
474
501
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
475
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.2.1/railties
|
|
502
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.2.3.1/railties
|
|
476
503
|
rubygems_mfa_required: 'true'
|
|
477
|
-
post_install_message:
|
|
478
504
|
rdoc_options:
|
|
479
505
|
- "--exclude"
|
|
480
506
|
- "."
|
|
@@ -491,8 +517,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
491
517
|
- !ruby/object:Gem::Version
|
|
492
518
|
version: '0'
|
|
493
519
|
requirements: []
|
|
494
|
-
rubygems_version:
|
|
495
|
-
signing_key:
|
|
520
|
+
rubygems_version: 4.0.6
|
|
496
521
|
specification_version: 4
|
|
497
522
|
summary: Tools for creating, working with, and running Rails applications.
|
|
498
523
|
test_files: []
|