railties 8.0.2.1 → 8.0.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: 3eb763dc516ac3300434d14aa683eb8b41447184c95f1f8639667f06cc4a8fce
4
- data.tar.gz: 643a8608aaf46744b0cabf0390f621c00b70d807c629ec3640c303a410daeab5
3
+ metadata.gz: 46e1da3cb0dd9f90ba6539fcd48b08a77155300031522c2a1d37c70b4c05ea6e
4
+ data.tar.gz: 8960aaa617926a966e515999e10668b5582a773a132de7cd2575088bc6017490
5
5
  SHA512:
6
- metadata.gz: f2100e27ffeed2deb6e797b67492b0dbb5f00dd7ef7ba2add542f22d7e9938d901b0be88902557be2fdba6419ccc49114c80bbd2f8f2049ebef9eb903112cfe9
7
- data.tar.gz: ef2ca4d16f7cbfcc8150ceecc83f2e162b3b9e3cf39bd1ec3eb4692d51b70c5681d658266de0a8d6fbe501af9ee2156f78f6cc025f390d8edecab342564bfe1b
6
+ metadata.gz: 3121cd89de8c287937ac033cb0e3bd902fc34d318b857e4176db1fbba562438bfd14e3ebaa669c09adf667ada86c70d84350cf08361bf1949ef1e98be9e2416a
7
+ data.tar.gz: d09a14c83c7fc1c9e752a52358f8343dc2d49b73ae5387a621c33774828bde8fdccac1a349b32c09205913ecd8e2019b8cfa748b778ed248a49adba06cc493fd
data/CHANGELOG.md CHANGED
@@ -1,9 +1,17 @@
1
- ## Rails 8.0.2.1 (August 13, 2025) ##
1
+ ## Rails 8.0.3 (September 22, 2025) ##
2
2
 
3
- * No changes.
3
+ * Fix `polymorphic_url` and `polymorphic_path` not working when routes are not loaded.
4
4
 
5
+ *Édouard Chin*
5
6
 
6
- ## Rails 8.0.2 (March 12, 2025) ##
7
+ * Fix Rails console to not override user defined IRB_NAME.
8
+
9
+ Only change the prompt name if it hasn't been customized in `.irbrc`.
10
+
11
+ *Jarrett Lusso*
12
+
13
+
14
+ ## Rails 8.0.2.1 (August 13, 2025) ##
7
15
 
8
16
  * No changes.
9
17
 
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
@@ -59,9 +59,7 @@ module Rails
59
59
  end
60
60
  else
61
61
  Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
62
- broadcast_logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
63
- broadcast_logger.formatter = Rails.logger.formatter
64
- Rails.logger = broadcast_logger
62
+ Rails.logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
65
63
  end
66
64
  end
67
65
 
@@ -9,7 +9,7 @@ module Rails
9
9
 
10
10
  attr_reader :route_sets, :paths, :external_routes, :loaded
11
11
  attr_accessor :eager_load
12
- attr_writer :run_after_load_paths # :nodoc:
12
+ attr_writer :run_after_load_paths, :loaded # :nodoc:
13
13
  delegate :execute_if_updated, :updated?, to: :updater
14
14
 
15
15
  def initialize
@@ -158,7 +158,11 @@ module Rails
158
158
 
159
159
  # Reload application routes regardless if they changed or not.
160
160
  def reload_routes!
161
- routes_reloader.reload!
161
+ if routes_reloader.execute_unless_loaded
162
+ routes_reloader.loaded = false
163
+ else
164
+ routes_reloader.reload!
165
+ end
162
166
  end
163
167
 
164
168
  def reload_routes_unless_loaded # :nodoc:
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "action_controller"
4
+
3
5
  class Rails::ApplicationController < ActionController::Base # :nodoc:
4
6
  prepend_view_path File.expand_path("templates", __dir__)
5
7
  layout "application"
@@ -87,7 +87,8 @@ module Rails
87
87
 
88
88
  env = colorized_env
89
89
  prompt_prefix = "%N(#{env})"
90
- IRB.conf[:IRB_NAME] = @app.name
90
+ # Respect user's configured irb name.
91
+ IRB.conf[:IRB_NAME] = @app.name if IRB.conf[:IRB_NAME] == "irb"
91
92
 
92
93
  IRB.conf[:PROMPT][:RAILS_PROMPT] = {
93
94
  PROMPT_I: "#{prompt_prefix}> ",
@@ -4,9 +4,11 @@
4
4
 
5
5
  require "action_dispatch/routing/route_set"
6
6
 
7
+ # :enddoc:
8
+
7
9
  module Rails
8
10
  class Engine
9
- class LazyRouteSet < ActionDispatch::Routing::RouteSet # :nodoc:
11
+ class LazyRouteSet < ActionDispatch::Routing::RouteSet
10
12
  class NamedRouteCollection < ActionDispatch::Routing::RouteSet::NamedRouteCollection
11
13
  def route_defined?(name)
12
14
  Rails.application&.reload_routes_unless_loaded
@@ -34,16 +36,6 @@ module Rails
34
36
  Rails.application&.reload_routes_unless_loaded
35
37
  super
36
38
  end
37
-
38
- def polymorphic_url(record_or_hash_or_array, options = {})
39
- Rails.application&.reload_routes_unless_loaded
40
- super
41
- end
42
-
43
- def polymorphic_path(record_or_hash_or_array, options = {})
44
- Rails.application&.reload_routes_unless_loaded
45
- super
46
- end
47
39
  end
48
40
 
49
41
  def initialize(config = DEFAULT_CONFIG)
@@ -68,6 +60,11 @@ module Rails
68
60
  super
69
61
  end
70
62
 
63
+ def polymorphic_mappings
64
+ Rails.application&.reload_routes_unless_loaded
65
+ super
66
+ end
67
+
71
68
  def draw(&block)
72
69
  Rails.application&.reload_routes_unless_loaded
73
70
  super
@@ -9,8 +9,8 @@ module Rails
9
9
  module VERSION
10
10
  MAJOR = 8
11
11
  MINOR = 0
12
- TINY = 2
13
- PRE = "1"
12
+ TINY = 3
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -7,12 +7,14 @@ require "open-uri"
7
7
  require "tsort"
8
8
  require "uri"
9
9
  require "rails/generators"
10
+ require "rails/generators/bundle_helper"
10
11
  require "active_support/core_ext/array/extract_options"
11
12
 
12
13
  module Rails
13
14
  module Generators
14
15
  class AppBase < Base # :nodoc:
15
16
  include AppName
17
+ include BundleHelper
16
18
 
17
19
  NODE_LTS_VERSION = "20.11.1"
18
20
  BUN_VERSION = "1.0.1"
@@ -642,32 +644,6 @@ module Rails
642
644
  end
643
645
  end
644
646
 
645
- def bundle_command(command, env = {})
646
- say_status :run, "bundle #{command}"
647
-
648
- # We are going to shell out rather than invoking Bundler::CLI.new(command)
649
- # because `rails new` loads the Thor gem and on the other hand bundler uses
650
- # its own vendored Thor, which could be a different version. Running both
651
- # things in the same process is a recipe for a night with paracetamol.
652
- #
653
- # Thanks to James Tucker for the Gem tricks involved in this call.
654
- _bundle_command = Gem.bin_path("bundler", "bundle")
655
-
656
- require "bundler"
657
- Bundler.with_original_env do
658
- exec_bundle_command(_bundle_command, command, env)
659
- end
660
- end
661
-
662
- def exec_bundle_command(bundle_command, command, env)
663
- full_command = %Q["#{Gem.ruby}" "#{bundle_command}" #{command}]
664
- if options[:quiet]
665
- system(env, full_command, out: File::NULL)
666
- else
667
- system(env, full_command)
668
- end
669
- end
670
-
671
647
  def bundle_install?
672
648
  !(options[:skip_bundle] || options[:pretend])
673
649
  end
@@ -677,7 +653,7 @@ module Rails
677
653
  end
678
654
 
679
655
  def depend_on_bootsnap?
680
- !options[:skip_bootsnap] && !options[:dev] && !defined?(JRUBY_VERSION)
656
+ !options[:skip_bootsnap] && !options[:dev] && !jruby?
681
657
  end
682
658
 
683
659
  def target_rails_prerelease(self_command = "new")
@@ -753,7 +729,7 @@ module Rails
753
729
  end
754
730
 
755
731
  def add_bundler_platforms
756
- if bundle_install?
732
+ if bundle_install? && !jruby?
757
733
  # The vast majority of Rails apps will be deployed on `x86_64-linux`.
758
734
  bundle_command("lock --add-platform=x86_64-linux")
759
735
 
@@ -768,6 +744,10 @@ module Rails
768
744
  end
769
745
  end
770
746
 
747
+ def jruby?
748
+ defined?(JRUBY_VERSION)
749
+ end
750
+
771
751
  def empty_directory_with_keep_file(destination, config = {})
772
752
  empty_directory(destination, config)
773
753
  keep_file(destination)
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rails
4
+ module Generators
5
+ module BundleHelper # :nodoc:
6
+ def bundle_command(command, env = {}, params = {})
7
+ say_status :run, "bundle #{command}"
8
+
9
+ # We are going to shell out rather than invoking Bundler::CLI.new(command)
10
+ # because `rails new` loads the Thor gem and on the other hand bundler uses
11
+ # its own vendored Thor, which could be a different version. Running both
12
+ # things in the same process is a recipe for a night with paracetamol.
13
+ #
14
+ # Thanks to James Tucker for the Gem tricks involved in this call.
15
+ _bundle_command = Gem.bin_path("bundler", "bundle")
16
+
17
+ require "bundler"
18
+ Bundler.with_original_env do
19
+ exec_bundle_command(_bundle_command, command, env, params)
20
+ end
21
+ end
22
+
23
+ private
24
+ def exec_bundle_command(bundle_command, command, env, params)
25
+ full_command = %Q["#{Gem.ruby}" "#{bundle_command}" #{command}]
26
+ if options[:quiet] || params[:quiet]
27
+ system(env, full_command, out: File::NULL)
28
+ else
29
+ system(env, full_command)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -272,9 +272,9 @@ module Rails
272
272
  dev: options[:dev],
273
273
  node: using_node?,
274
274
  app_name: app_name,
275
- skip_solid: options[:skip_solid]
275
+ skip_solid: options[:skip_solid],
276
+ pretend: options[:pretend]
276
277
  }
277
-
278
278
  Rails::Generators::DevcontainerGenerator.new([], devcontainer_options).invoke_all
279
279
  end
280
280
  end
@@ -72,7 +72,7 @@ RUN yarn install --immutable
72
72
  <% end -%>
73
73
  <% if using_bun? -%>
74
74
  # Install node modules
75
- COPY package.json bun.lockb ./
75
+ COPY package.json bun.lock* ./
76
76
  RUN bun install --frozen-lockfile
77
77
 
78
78
  <% end -%>
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "rails/generators/bundle_helper"
4
+
3
5
  module Rails
4
6
  module Generators
5
7
  class AuthenticationGenerator < Base # :nodoc:
8
+ include BundleHelper
9
+
6
10
  class_option :api, type: :boolean,
7
11
  desc: "Generate API-only controllers and models, with no view templates"
8
12
 
@@ -25,8 +29,6 @@ module Rails
25
29
 
26
30
  template "app/views/passwords_mailer/reset.html.erb"
27
31
  template "app/views/passwords_mailer/reset.text.erb"
28
-
29
- template "test/mailers/previews/passwords_mailer_preview.rb"
30
32
  end
31
33
 
32
34
  def configure_application_controller
@@ -41,9 +43,9 @@ module Rails
41
43
  def enable_bcrypt
42
44
  if File.read("Gemfile").include?('gem "bcrypt"')
43
45
  uncomment_lines "Gemfile", /gem "bcrypt"/
44
- Bundler.with_original_env { execute_command :bundle, "install --quiet" }
46
+ bundle_command("install --quiet")
45
47
  else
46
- Bundler.with_original_env { execute_command :bundle, "add bcrypt", capture: true }
48
+ bundle_command("add bcrypt", {}, quiet: true)
47
49
  end
48
50
  end
49
51
 
@@ -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
 
@@ -9,6 +9,10 @@ module TestUnit # :nodoc:
9
9
  template "test/fixtures/users.yml"
10
10
  template "test/models/user_test.rb"
11
11
  end
12
+
13
+ def create_mailer_preview_files
14
+ template "test/mailers/previews/passwords_mailer_preview.rb" if defined?(ActionMailer::Railtie)
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "action_controller"
4
+
3
5
  module Rails
4
6
  # Built-in Health Check Endpoint
5
7
  #
data/lib/rails/info.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "cgi"
3
+ require "cgi/escape"
4
+ require "cgi/util" if RUBY_VERSION < "3.5"
4
5
 
5
6
  module Rails
6
7
  # This module helps build the runtime properties that are displayed in
@@ -155,7 +155,7 @@
155
155
  <% end %>
156
156
 
157
157
  <dt>EML File:</dt>
158
- <dd><%= link_to "Download", action: :download %></dd>
158
+ <dd><%= link_to "Download", action: :download, locale: params[:locale] %></dd>
159
159
  </dl>
160
160
  </header>
161
161
 
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: 8.0.2.1
4
+ version: 8.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,28 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 8.0.2.1
18
+ version: 8.0.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: 8.0.2.1
25
+ version: 8.0.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: 8.0.2.1
32
+ version: 8.0.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: 8.0.2.1
39
+ version: 8.0.3
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rackup
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -113,20 +113,34 @@ dependencies:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
115
  version: '1.13'
116
+ - !ruby/object:Gem::Dependency
117
+ name: tsort
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0.2'
123
+ type: :runtime
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0.2'
116
130
  - !ruby/object:Gem::Dependency
117
131
  name: actionview
118
132
  requirement: !ruby/object:Gem::Requirement
119
133
  requirements:
120
134
  - - '='
121
135
  - !ruby/object:Gem::Version
122
- version: 8.0.2.1
136
+ version: 8.0.3
123
137
  type: :development
124
138
  prerelease: false
125
139
  version_requirements: !ruby/object:Gem::Requirement
126
140
  requirements:
127
141
  - - '='
128
142
  - !ruby/object:Gem::Version
129
- version: 8.0.2.1
143
+ version: 8.0.3
130
144
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
131
145
  email: david@loudthinking.com
132
146
  executables:
@@ -222,6 +236,7 @@ files:
222
236
  - lib/rails/generators/app_base.rb
223
237
  - lib/rails/generators/app_name.rb
224
238
  - lib/rails/generators/base.rb
239
+ - lib/rails/generators/bundle_helper.rb
225
240
  - lib/rails/generators/database.rb
226
241
  - lib/rails/generators/erb.rb
227
242
  - lib/rails/generators/erb/authentication/authentication_generator.rb
@@ -327,7 +342,6 @@ files:
327
342
  - lib/rails/generators/rails/authentication/templates/app/models/user.rb.tt
328
343
  - lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt
329
344
  - lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt
330
- - lib/rails/generators/rails/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb.tt
331
345
  - lib/rails/generators/rails/benchmark/USAGE
332
346
  - lib/rails/generators/rails/benchmark/benchmark_generator.rb
333
347
  - lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt
@@ -412,6 +426,7 @@ files:
412
426
  - lib/rails/generators/test_unit.rb
413
427
  - lib/rails/generators/test_unit/authentication/authentication_generator.rb
414
428
  - lib/rails/generators/test_unit/authentication/templates/test/fixtures/users.yml.tt
429
+ - lib/rails/generators/test_unit/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb.tt
415
430
  - lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt
416
431
  - lib/rails/generators/test_unit/controller/controller_generator.rb
417
432
  - lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt
@@ -490,10 +505,10 @@ licenses:
490
505
  - MIT
491
506
  metadata:
492
507
  bug_tracker_uri: https://github.com/rails/rails/issues
493
- changelog_uri: https://github.com/rails/rails/blob/v8.0.2.1/railties/CHANGELOG.md
494
- documentation_uri: https://api.rubyonrails.org/v8.0.2.1/
508
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.3/railties/CHANGELOG.md
509
+ documentation_uri: https://api.rubyonrails.org/v8.0.3/
495
510
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
496
- source_code_uri: https://github.com/rails/rails/tree/v8.0.2.1/railties
511
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.3/railties
497
512
  rubygems_mfa_required: 'true'
498
513
  rdoc_options:
499
514
  - "--exclude"