railties 7.2.2.2 → 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.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +159 -256
  3. data/README.rdoc +1 -1
  4. data/lib/minitest/rails_plugin.rb +2 -2
  5. data/lib/rails/application/bootstrap.rb +1 -4
  6. data/lib/rails/application/configuration.rb +22 -21
  7. data/lib/rails/application/default_middleware_stack.rb +4 -0
  8. data/lib/rails/application/finisher.rb +2 -3
  9. data/lib/rails/application/routes_reloader.rb +17 -3
  10. data/lib/rails/application.rb +22 -10
  11. data/lib/rails/application_controller.rb +2 -0
  12. data/lib/rails/backtrace_cleaner.rb +3 -3
  13. data/lib/rails/code_statistics.rb +128 -86
  14. data/lib/rails/code_statistics_calculator.rb +78 -76
  15. data/lib/rails/command/helpers/editor.rb +1 -1
  16. data/lib/rails/command.rb +0 -6
  17. data/lib/rails/commands/app/update_command.rb +5 -9
  18. data/lib/rails/commands/console/irb_console.rb +3 -19
  19. data/lib/rails/commands/credentials/USAGE +4 -4
  20. data/lib/rails/commands/credentials/credentials_command.rb +5 -1
  21. data/lib/rails/commands/dev/dev_command.rb +1 -1
  22. data/lib/rails/commands/devcontainer/devcontainer_command.rb +2 -1
  23. data/lib/rails/commands/stats/stats_command.rb +19 -0
  24. data/lib/rails/commands/test/test_command.rb +0 -2
  25. data/lib/rails/console/methods.rb +5 -21
  26. data/lib/rails/dev_caching.rb +2 -2
  27. data/lib/rails/engine/configuration.rb +3 -1
  28. data/lib/rails/engine/lazy_route_set.rb +111 -0
  29. data/lib/rails/engine.rb +10 -6
  30. data/lib/rails/gem_version.rb +4 -4
  31. data/lib/rails/generators/actions.rb +12 -8
  32. data/lib/rails/generators/app_base.rb +67 -56
  33. data/lib/rails/generators/base.rb +0 -4
  34. data/lib/rails/generators/bundle_helper.rb +34 -0
  35. data/lib/rails/generators/database.rb +101 -67
  36. data/lib/rails/generators/erb/authentication/authentication_generator.rb +15 -0
  37. data/lib/rails/generators/erb/authentication/templates/app/views/passwords/edit.html.erb +9 -0
  38. data/lib/rails/generators/erb/authentication/templates/app/views/passwords/new.html.erb +8 -0
  39. data/lib/rails/generators/erb/authentication/templates/app/views/sessions/new.html.erb +11 -0
  40. data/lib/rails/generators/generated_attribute.rb +16 -11
  41. data/lib/rails/generators/rails/app/app_generator.rb +30 -30
  42. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +22 -6
  43. data/lib/rails/generators/rails/app/templates/Gemfile.tt +27 -12
  44. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +6 -11
  45. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +10 -3
  46. data/lib/rails/generators/rails/app/templates/bin/dev.tt +1 -0
  47. data/lib/rails/generators/rails/app/templates/bin/setup.tt +5 -8
  48. data/lib/rails/generators/rails/app/templates/bin/thrust.tt +4 -0
  49. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +24 -1
  50. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +23 -0
  51. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +50 -0
  52. data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +30 -5
  53. data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +128 -0
  54. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +12 -23
  55. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +31 -51
  56. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +5 -19
  57. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +0 -7
  58. data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +1 -1
  59. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +30 -0
  60. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +11 -2
  61. data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +3 -3
  62. data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +4 -3
  63. data/lib/rails/generators/rails/app/templates/dockerignore.tt +7 -2
  64. data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +11 -3
  65. data/lib/rails/generators/rails/app/templates/gitignore.tt +1 -2
  66. data/lib/rails/generators/rails/app/templates/kamal-secrets.tt +17 -0
  67. data/lib/rails/generators/rails/app/templates/public/400.html +114 -0
  68. data/lib/rails/generators/rails/app/templates/public/404.html +113 -66
  69. data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +113 -65
  70. data/lib/rails/generators/rails/app/templates/public/422.html +113 -66
  71. data/lib/rails/generators/rails/app/templates/public/500.html +113 -65
  72. data/lib/rails/generators/rails/app/templates/public/icon.png +0 -0
  73. data/lib/rails/generators/rails/app/templates/public/icon.svg +2 -2
  74. data/lib/rails/generators/rails/authentication/USAGE +6 -0
  75. data/lib/rails/generators/rails/authentication/authentication_generator.rb +60 -0
  76. data/lib/rails/generators/rails/authentication/templates/app/channels/application_cable/connection.rb.tt +16 -0
  77. data/lib/rails/generators/rails/authentication/templates/app/controllers/concerns/authentication.rb.tt +52 -0
  78. data/lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt +33 -0
  79. data/lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt +21 -0
  80. data/lib/rails/generators/rails/authentication/templates/app/mailers/passwords_mailer.rb.tt +6 -0
  81. data/lib/rails/generators/rails/authentication/templates/app/models/current.rb.tt +4 -0
  82. data/lib/rails/generators/rails/authentication/templates/app/models/session.rb.tt +3 -0
  83. data/lib/rails/generators/rails/authentication/templates/app/models/user.rb.tt +6 -0
  84. data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt +4 -0
  85. data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt +2 -0
  86. data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +4 -0
  87. data/lib/rails/generators/rails/db/system/change/change_generator.rb +1 -1
  88. data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +12 -2
  89. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +1 -1
  90. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +4 -4
  91. data/lib/rails/generators/rails/plugin/plugin_generator.rb +7 -9
  92. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +1 -1
  93. data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +4 -3
  94. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +4 -4
  95. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +5 -5
  96. data/lib/rails/generators/rails/script/USAGE +18 -0
  97. data/lib/rails/generators/rails/script/script_generator.rb +18 -0
  98. data/lib/rails/generators/rails/script/templates/script.rb.tt +3 -0
  99. data/lib/rails/generators/test_unit/authentication/authentication_generator.rb +18 -0
  100. data/lib/rails/generators/test_unit/authentication/templates/test/fixtures/users.yml.tt +9 -0
  101. data/lib/rails/generators/test_unit/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb.tt +7 -0
  102. data/lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt +7 -0
  103. data/lib/rails/generators.rb +6 -5
  104. data/lib/rails/health_controller.rb +2 -0
  105. data/lib/rails/info.rb +2 -1
  106. data/lib/rails/info_controller.rb +10 -4
  107. data/lib/rails/rack/silence_request.rb +33 -0
  108. data/lib/rails/rack.rb +1 -0
  109. data/lib/rails/source_annotation_extractor.rb +31 -14
  110. data/lib/rails/tasks/statistics.rake +13 -28
  111. data/lib/rails/templates/rails/info/notes.html.erb +65 -0
  112. data/lib/rails/templates/rails/mailers/email.html.erb +1 -1
  113. data/lib/rails/test_unit/runner.rb +8 -3
  114. data/lib/rails/test_unit/test_parser.rb +18 -15
  115. metadata +59 -22
  116. data/lib/rails/console/app.rb +0 -8
  117. data/lib/rails/console/helpers.rb +0 -8
  118. data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -2
  119. data/lib/rails/generators/rails/app/templates/app/channels/application_cable/channel.rb.tt +0 -4
  120. data/lib/rails/generators/rails/app/templates/app/channels/application_cable/connection.rb.tt +0 -4
  121. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt +0 -70
  122. data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +0 -13
  123. data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +0 -13
  124. data/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js.tt +0 -10
  125. data/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js.tt +0 -6
  126. data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8009fa588f07cda8a4b7c679458e6c63c086752e0705a86b655a40839f939e9f
4
- data.tar.gz: 7924907690eeb96418682545eb00365039b467768829e73148c0ac88283b6704
3
+ metadata.gz: 46e1da3cb0dd9f90ba6539fcd48b08a77155300031522c2a1d37c70b4c05ea6e
4
+ data.tar.gz: 8960aaa617926a966e515999e10668b5582a773a132de7cd2575088bc6017490
5
5
  SHA512:
6
- metadata.gz: ab68f603242dc368dd9463696055540f3c934f0b2c0e0c59aacdc4bf1407b785cce046a6cd1c058707102942df886c6cef29ac278c47cc51b276ccf485b375b5
7
- data.tar.gz: 971f1611acc1d4aead3a199ecffab02c5e72bfbf716565c254cb6bda21c0ce0520ae4e9950756f408eb7afce173701d3495d2868b49599abaf0c039f03b66f24
6
+ metadata.gz: 3121cd89de8c287937ac033cb0e3bd902fc34d318b857e4176db1fbba562438bfd14e3ebaa669c09adf667ada86c70d84350cf08361bf1949ef1e98be9e2416a
7
+ data.tar.gz: d09a14c83c7fc1c9e752a52358f8343dc2d49b73ae5387a621c33774828bde8fdccac1a349b32c09205913ecd8e2019b8cfa748b778ed248a49adba06cc493fd
data/CHANGELOG.md CHANGED
@@ -1,386 +1,289 @@
1
- ## Rails 7.2.2.2 (August 13, 2025) ##
2
-
3
- * No changes.
4
-
5
-
6
- ## Rails 7.2.2.1 (December 10, 2024) ##
7
-
8
- * No changes.
1
+ ## Rails 8.0.3 (September 22, 2025) ##
9
2
 
3
+ * Fix `polymorphic_url` and `polymorphic_path` not working when routes are not loaded.
10
4
 
11
- ## Rails 7.2.2 (October 30, 2024) ##
12
-
13
- * No changes.
5
+ *Édouard Chin*
14
6
 
7
+ * Fix Rails console to not override user defined IRB_NAME.
15
8
 
16
- ## Rails 7.2.1.2 (October 23, 2024) ##
9
+ Only change the prompt name if it hasn't been customized in `.irbrc`.
17
10
 
18
- * No changes.
11
+ *Jarrett Lusso*
19
12
 
20
13
 
21
- ## Rails 7.2.1.1 (October 15, 2024) ##
14
+ ## Rails 8.0.2.1 (August 13, 2025) ##
22
15
 
23
16
  * No changes.
24
17
 
25
18
 
26
- ## Rails 7.2.1 (August 22, 2024) ##
19
+ ## Rails 8.0.2 (March 12, 2025) ##
27
20
 
28
- * Fix `rails console` for application with non default application constant.
21
+ * Fix Rails console to load routes.
29
22
 
30
- The wrongly assumed the Rails application would be named `AppNamespace::Application`,
31
- which is the default but not an obligation.
23
+ Otherwise `*_path` and `*url` methods are missing on the `app` object.
32
24
 
33
- *Jean Boussier*
25
+ *Édouard Chin*
34
26
 
35
- * Fix the default Dockerfile to include the full sqlite3 package.
27
+ * Update `rails new --minimal` option
36
28
 
37
- Prior to this it only included `libsqlite3`, so it wasn't enough to
38
- run `rails dbconsole`.
29
+ Extend the `--minimal` flag to exclude recently added features:
30
+ `skip_brakeman`, `skip_ci`, `skip_docker`, `skip_kamal`, `skip_rubocop`, `skip_solid` and `skip_thruster`.
39
31
 
40
- *Jerome Dalbert*
32
+ *eelcoj*
41
33
 
42
- * Don't update public directory during `app:update` command for API-only Applications.
34
+ * Use `secret_key_base` from ENV or credentials when present locally.
43
35
 
44
- *y-yagi*
45
-
46
- * Don't add bin/brakeman if brakeman is not in bundle when upgrading an application.
36
+ When ENV["SECRET_KEY_BASE"] or
37
+ `Rails.application.credentials.secret_key_base` is set for test or
38
+ development, it is used for the `Rails.config.secret_key_base`,
39
+ instead of generating a `tmp/local_secret.txt` file.
47
40
 
48
- *Etienne Barrié*
41
+ *Petrik de Heus*
49
42
 
50
- * Remove PWA views and routes if its an API only project.
51
43
 
52
- *Jean Boussier*
44
+ ## Rails 8.0.1 (December 13, 2024) ##
53
45
 
54
- * Simplify generated Puma configuration
46
+ * Skip generation system tests related code for CI when `--skip-system-test` is given.
55
47
 
56
- *DHH*, *Rafael Mendonça França*
48
+ *fatkodima*
57
49
 
50
+ * Don't add bin/thrust if thruster is not in Gemfile.
58
51
 
59
- ## Rails 7.2.0 (August 09, 2024) ##
52
+ *Étienne Barrié*
60
53
 
61
- * The new `bin/rails boot` command boots the application and exits. Supports the
62
- standard `-e/--environment` options.
54
+ * Don't install a package for system test when applications don't use it.
63
55
 
64
- *Xavier Noria*
56
+ *y-yagi*
65
57
 
66
- * Create a Dev Container Generator that generates a Dev Container setup based on the current configuration
67
- of the application. Usage:
68
58
 
69
- `bin/rails devcontainer`
59
+ ## Rails 8.0.0.1 (December 10, 2024) ##
70
60
 
71
- *Andrew Novoselac*
61
+ * No changes.
72
62
 
73
- * Add Rubocop and GitHub Actions to plugin generator.
74
- This can be skipped using --skip-rubocop and --skip-ci.
75
63
 
76
- *Chris Oliver*
64
+ ## Rails 8.0.0 (November 07, 2024) ##
77
65
 
78
- * Remove support for `oracle`, `sqlserver` and JRuby specific database adapters from the
79
- `rails new` and `rails db:system:change` commands.
66
+ * No changes.
80
67
 
81
- The supported options are `sqlite3`, `mysql`, `postgresql` and `trilogy`.
82
68
 
83
- *Andrew Novoselac*
69
+ ## Rails 8.0.0.rc2 (October 30, 2024) ##
84
70
 
85
- * Add options to `bin/rails app:update`.
71
+ * Fix incorrect database.yml with `skip_solid`.
86
72
 
87
- `bin/rails app:update` now supports the same generic options that generators do:
73
+ *Joé Dupuis*
88
74
 
89
- * `--force`: Accept all changes to existing files
90
- * `--skip`: Refuse all changes to existing files
91
- * `--pretend`: Don't make any changes
92
- * `--quiet`: Don't output all changes made
75
+ * Set `Regexp.timeout` to `1`s by default to improve security over Regexp Denial-of-Service attacks.
93
76
 
94
- *Étienne Barrié*
77
+ *Rafael Mendonça França*
95
78
 
96
- * Implement Rails console commands and helpers with IRB v1.13's extension APIs.
97
79
 
98
- Rails console users will now see `helper`, `controller`, `new_session`, and `app` under
99
- IRB help message's `Helper methods` category. And `reload!` command will be displayed under
100
- the new `Rails console` commands category.
80
+ ## Rails 8.0.0.rc1 (October 19, 2024) ##
101
81
 
102
- Prior to this change, Rails console's commands and helper methods are added through IRB's
103
- private components and don't show up in its help message, which led to poor discoverability.
82
+ * Remove deprecated support to extend Rails console through `Rails::ConsoleMethods`.
104
83
 
105
- *Stan Lo*
84
+ *Rafael Mendonça França*
106
85
 
107
- * Remove deprecated `Rails::Generators::Testing::Behaviour`.
86
+ * Remove deprecated file `rails/console/helpers`.
108
87
 
109
88
  *Rafael Mendonça França*
110
89
 
111
- * Remove deprecated `find_cmd_and_exec` console helper.
90
+ * Remove deprecated file `rails/console/app`.
112
91
 
113
92
  *Rafael Mendonça França*
114
93
 
115
- * Remove deprecated `Rails.config.enable_dependency_loading`.
94
+ * Remove deprecated `config.read_encrypted_secrets`.
116
95
 
117
96
  *Rafael Mendonça França*
118
97
 
119
- * Remove deprecated `Rails.application.secrets`.
98
+ * Add Kamal support for devcontainers
120
99
 
121
- *Rafael Mendonça França*
100
+ Previously generated devcontainer could not use docker and therefore Kamal.
122
101
 
123
- * Generated Gemfile will include `require: "debug/prelude"` for the `debug` gem.
102
+ *Joé Dupuis*
124
103
 
125
- Requiring `debug` gem directly automatically activates it, which could introduce
126
- additional overhead and memory usage even without entering a debugging session.
127
104
 
128
- By making Bundler require `debug/prelude` instead, developers can keep their access
129
- to breakpoint methods like `debugger` or `binding.break`, but the debugger won't be
130
- activated until a breakpoint is hit.
105
+ ## Rails 8.0.0.beta1 (September 26, 2024) ##
131
106
 
132
- *Stan Lo*
107
+ * Exit `rails g` with code 1 if generator could not be found.
133
108
 
134
- * Skip generating a `test` job in ci.yml when a new application is generated with the
135
- `--skip-test` option.
109
+ Previously `rails g` returned 0, which would make it harder to catch typos in scripts calling `rails g`.
136
110
 
137
- *Steve Polito*
111
+ *Christopher Özbek*
138
112
 
139
- * Update the `.node-version` file conditionally generated for new applications to 20.11.1
113
+ * Remove `require_*` statements from application.css to align with the transition from Sprockets to Propshaft.
140
114
 
141
- *Steve Polito*
115
+ With Propshaft as the default asset pipeline in Rails 8, the require_tree and require_self clauses in application.css are no longer necessary, as they were specific to Sprockets. Additionally, the comment has been updated to clarify that CSS precedence now follows standard cascading order without automatic prioritization by the asset pipeline.
142
116
 
143
- * Fix sanitizer vendor configuration in 7.1 defaults.
117
+ *Eduardo Alencar*
144
118
 
145
- In apps where rails-html-sanitizer was not eagerly loaded, the sanitizer default could end up
146
- being Rails::HTML4::Sanitizer when it should be set to Rails::HTML5::Sanitizer.
119
+ * Do not include redis by default in generated Dev Containers.
147
120
 
148
- *Mike Dalessio*, *Rafael Mendonça França*
121
+ Now that applications use the Solid Queue and Solid Cache gems by default, we do not need to include redis
122
+ in the Dev Container. We will only include redis if `--skip-solid` is used when generating an app that uses
123
+ Active Job or Action Cable.
149
124
 
150
- * Set `action_mailer.default_url_options` values in `development` and `test`.
125
+ When generating a Dev Container for an existing app, we will not include redis if either of the solid gems
126
+ are in use.
151
127
 
152
- Prior to this commit, new Rails applications would raise `ActionView::Template::Error`
153
- if a mailer included a url built with a `*_path` helper.
128
+ *Andrew Novoselac*
154
129
 
155
- *Steve Polito*
130
+ * Use [Solid Cable](https://github.com/rails/solid_cable) as the default Action Cable adapter in production, configured as a separate queue database in config/database.yml. It keeps messages in a table and continuously polls for updates. This makes it possible to drop the common dependency on Redis, if it isn't needed for any other purpose. Despite polling, the performance of Solid Cable is comparable to Redis in most situations. And in all circumstances, it makes it easier to deploy Rails when Redis is no longer a required dependency for Action Cable functionality.
156
131
 
157
- * Introduce `Rails::Generators::Testing::Assertions#assert_initializer`.
132
+ *DHH*
158
133
 
159
- Compliments the existing `initializer` generator action.
134
+ * Use [Solid Queue](https://github.com/rails/solid_queue) as the default Active Job backend in production, configured as a separate queue database in config/database.yml. In a single-server deployment, it'll run as a Puma plugin. This is configured in `config/deploy.yml` and can easily be changed to use a dedicated jobs machine.
160
135
 
161
- ```rb
162
- assert_initializer "mail_interceptors.rb"
163
- ```
136
+ *DHH*
137
+
138
+ * Use [Solid Cache](https://github.com/rails/solid_cache) as the default Rails.cache backend in production, configured as a separate cache database in config/database.yml.
164
139
 
165
- *Steve Polito*
140
+ *DHH*
166
141
 
167
- * Generate a .devcontainer folder and its contents when creating a new app.
142
+ * Add Rails::Rack::SilenceRequest middleware and use it via `config.silence_healthcheck_path = path`
143
+ to silence requests to "/up". This prevents the Kamal-required health checks from clogging up
144
+ the production logs.
168
145
 
169
- The .devcontainer folder includes everything needed to boot the app and do development in a remote container.
146
+ *DHH*
170
147
 
171
- The container setup includes:
172
- - A redis container for Kredis, ActionCable etc.
173
- - A database (SQLite, Postgres, MySQL or MariaDB)
174
- - A Headless chrome container for system tests
175
- - Active Storage configured to use the local disk and with preview features working
148
+ * Introduce `mariadb-mysql` and `mariadb-trilogy` database options for `rails new`
176
149
 
177
- If any of these options are skipped in the app setup they will not be included in the container configuration.
150
+ When used with the `--devcontainer` flag, these options will use `mariadb` as the database for the
151
+ Dev Container. The original `mysql` and `trilogy` options will use `mysql`. Users who are not
152
+ generating a Dev Container do not need to use the new options.
178
153
 
179
- These files can be skipped using the `--skip-devcontainer` option.
154
+ *Andrew Novoselac*
180
155
 
181
- *Andrew Novoselac & Rafael Mendonça França*
156
+ * Deprecate `::STATS_DIRECTORIES`.
182
157
 
183
- * Introduce `SystemTestCase#served_by` for configuring the System Test application server.
158
+ The global constant `STATS_DIRECTORIES` has been deprecated in favor of
159
+ `Rails::CodeStatistics.register_directory`.
184
160
 
185
- By default this is localhost. This method allows the host and port to be specified manually.
161
+ Add extra directories with `Rails::CodeStatistics.register_directory(label, path)`:
186
162
 
187
163
  ```ruby
188
- class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
189
- served_by host: "testserver", port: 45678
190
- end
164
+ require "rails/code_statistics"
165
+ Rails::CodeStatistics.register_directory('My Directory', 'path/to/dir')
191
166
  ```
192
167
 
193
- *Andrew Novoselac & Rafael Mendonça França*
168
+ *Petrik de Heus*
194
169
 
195
- * `bin/rails test` will no longer load files named `*_test.rb` if they are located in the `fixtures` folder.
170
+ * Enable query log tags by default on development env
196
171
 
197
- *Edouard Chin*
172
+ This can be used to trace troublesome SQL statements back to the application
173
+ code that generated these statements. It is also useful when using multiple
174
+ databases because the query logs can identify which database is being used.
198
175
 
199
- * Ensure logger tags configured with `config.log_tags` are still active in `request.action_dispatch` handlers.
176
+ *Matheus Richard*
200
177
 
201
- *KJ Tsanaktsidis*
178
+ * Defer route drawing to the first request, or when url_helpers are called
202
179
 
203
- * Setup jemalloc in the default Dockerfile for memory optimization.
180
+ Executes the first routes reload in middleware, or when a route set's
181
+ url_helpers receives a route call / asked if it responds to a route.
182
+ Previously, this was executed unconditionally on boot, which can
183
+ slow down boot time unnecessarily for larger apps with lots of routes.
204
184
 
205
- *Matt Almeida*, *Jean Boussier*
185
+ Environments like production that have `config.eager_load = true` will
186
+ continue to eagerly load routes on boot.
206
187
 
207
- * Commented out lines in .railsrc file should not be treated as arguments when using
208
- rails new generator command. Update ARGVScrubber to ignore text after `#` symbols.
188
+ *Gannon McGibbon*
209
189
 
210
- *Willian Tenfen*
190
+ * Generate form helpers to use `textarea*` methods instead of `text_area*` methods
211
191
 
212
- * Skip CSS when generating APIs.
192
+ *Sean Doyle*
213
193
 
214
- *Ruy Rocha*
194
+ * Add authentication generator to give a basic start to an authentication system using database-tracked sessions and password reset.
215
195
 
216
- * Rails console now indicates application name and the current Rails environment:
196
+ Generate with...
217
197
 
218
- ```txt
219
- my-app(dev)> # for RAILS_ENV=development
220
- my-app(test)> # for RAILS_ENV=test
221
- my-app(prod)> # for RAILS_ENV=production
222
- my-app(my_env)> # for RAILS_ENV=my_env
198
+ ```
199
+ bin/rails generate authentication
223
200
  ```
224
201
 
225
- The application name is derived from the application's module name from `config/application.rb`.
226
- For example, `MyApp` will displayed as `my-app` in the prompt.
227
-
228
- Additionally, the environment name will be colorized when the environment is
229
- `development` (blue), `test` (blue), or `production` (red), if your
230
- terminal supports it.
231
-
232
- *Stan Lo*
233
-
234
- * Ensure `autoload_paths`, `autoload_once_paths`, `eager_load_paths`, and
235
- `load_paths` only have directories when initialized from engine defaults.
236
-
237
- Previously, files under the `app` directory could end up there too.
238
-
239
- *Takumasa Ochi*
240
-
241
- * Prevent unnecessary application reloads in development.
242
-
243
- Previously, some files outside autoload paths triggered unnecessary reloads.
244
- With this fix, application reloads according to `Rails.autoloaders.main.dirs`,
245
- thereby preventing unnecessary reloads.
246
-
247
- *Takumasa Ochi*
248
-
249
- * Use `oven-sh/setup-bun` in GitHub CI when generating an app with Bun.
250
-
251
- *TangRufus*
252
-
253
- * Disable `pidfile` generation in the `production` environment.
202
+ Generated files:
254
203
 
255
- *Hans Schnedlitz*
204
+ ```
205
+ app/models/current.rb
206
+ app/models/user.rb
207
+ app/models/session.rb
208
+ app/controllers/sessions_controller.rb
209
+ app/controllers/passwords_controller.rb
210
+ app/mailers/passwords_mailer.rb
211
+ app/views/sessions/new.html.erb
212
+ app/views/passwords/new.html.erb
213
+ app/views/passwords/edit.html.erb
214
+ app/views/passwords_mailer/reset.html.erb
215
+ app/views/passwords_mailer/reset.text.erb
216
+ db/migrate/xxxxxxx_create_users.rb
217
+ db/migrate/xxxxxxx_create_sessions.rb
218
+ test/mailers/previews/passwords_mailer_preview.rb
219
+ ```
256
220
 
257
- * Set `config.action_view.annotate_rendered_view_with_filenames` to `true` in
258
- the `development` environment.
221
+ *DHH*
259
222
 
260
- *Adrian Marin*
261
223
 
262
- * Support the `BACKTRACE` environment variable to turn off backtrace cleaning.
224
+ * Add not-null type modifier to migration attributes.
263
225
 
264
- Useful for debugging framework code:
226
+ Generating with...
265
227
 
266
- ```sh
267
- BACKTRACE=1 bin/rails server
228
+ ```
229
+ bin/rails generate migration CreateUsers email_address:string!:uniq password_digest:string!
268
230
  ```
269
231
 
270
- *Alex Ghiculescu*
271
-
272
- * Raise `ArgumentError` when reading `config.x.something` with arguments:
232
+ Produces:
273
233
 
274
234
  ```ruby
275
- config.x.this_works.this_raises true # raises ArgumentError
235
+ class CreateUsers < ActiveRecord::Migration[8.0]
236
+ def change
237
+ create_table :users do |t|
238
+ t.string :email_address, null: false
239
+ t.string :password_digest, null: false
240
+
241
+ t.timestamps
242
+ end
243
+ add_index :users, :email_address, unique: true
244
+ end
245
+ end
276
246
  ```
277
247
 
278
- *Sean Doyle*
279
-
280
- * Add default PWA files for manifest and service-worker that are served from `app/views/pwa` and can be dynamically rendered through ERB. Mount these files explicitly at the root with default routes in the generated routes file.
281
-
282
- *DHH*
283
-
284
- * Updated system tests to now use headless Chrome by default for the new applications.
285
-
286
- *DHH*
287
-
288
- * Add GitHub CI files for Dependabot, Brakeman, RuboCop, and running tests by default. Can be skipped with `--skip-ci`.
289
-
290
248
  *DHH*
291
249
 
292
- * Add Brakeman by default for static analysis of security vulnerabilities. Allow skipping with `--skip-brakeman option`.
293
-
294
- *vipulnsward*
295
-
296
- * Add RuboCop with rules from `rubocop-rails-omakase` by default. Skip with `--skip-rubocop`.
297
-
298
- *DHH* and *zzak*
299
-
300
- * Use `bin/rails runner --skip-executor` to not wrap the runner script with an
301
- Executor.
302
-
303
- *Ben Sheldon*
304
-
305
- * Fix isolated engines to take `ActiveRecord::Base.table_name_prefix` into consideration.
306
-
307
- This will allow for engine defined models, such as inside Active Storage, to respect
308
- Active Record table name prefix configuration.
309
-
310
- *Chedli Bourguiba*
311
-
312
- * Fix running `db:system:change` when the app has no Dockerfile.
313
-
314
- *Hartley McGuire*
250
+ * Add a `script` folder to applications, and a scripts generator.
315
251
 
316
- * In Action Mailer previews, list inline attachments separately from normal
317
- attachments.
252
+ The new `script` folder is meant to hold one-off or general purpose scripts,
253
+ such as data migration scripts, cleanup scripts, etc.
318
254
 
319
- For example, attachments that were previously listed like
320
-
321
- > Attachments: logo.png file1.pdf file2.pdf
322
-
323
- will now be listed like
324
-
325
- > Attachments: file1.pdf file2.pdf (Inline: logo.png)
326
-
327
- *Christian Schmidt* and *Jonathan Hefner*
328
-
329
- * In mailer preview, only show SMTP-To if it differs from the union of To, Cc and Bcc.
330
-
331
- *Christian Schmidt*
332
-
333
- * Enable YJIT by default on new applications running Ruby 3.3+.
334
-
335
- This can be disabled by setting `Rails.application.config.yjit = false`
336
-
337
- *Jean Boussier*, *Rafael Mendonça França*
338
-
339
- * In Action Mailer previews, show date from message `Date` header if present.
340
-
341
- *Sampat Badhe*
342
-
343
- * Exit with non-zero status when the migration generator fails.
344
-
345
- *Katsuhiko YOSHIDA*
346
-
347
- * Use numeric UID and GID in Dockerfile template.
348
-
349
- The Dockerfile generated by `rails new` sets the default user and group
350
- by name instead of UID:GID. This can cause the following error in Kubernetes:
255
+ A new script generator allows you to create such scripts:
351
256
 
352
257
  ```
353
- container has runAsNonRoot and image has non-numeric user (rails), cannot verify user is non-root
258
+ bin/rails generate script my_script
259
+ bin/rails generate script data/backfill
354
260
  ```
355
261
 
356
- This change sets default user and group by their numeric values.
262
+ You can run the generated script using:
357
263
 
358
- *Ivan Fedotov*
359
-
360
- * Disallow invalid values for rails new options.
264
+ ```
265
+ bundle exec ruby script/my_script.rb
266
+ bundle exec ruby script/data/backfill.rb
267
+ ```
361
268
 
362
- The `--database`, `--asset-pipeline`, `--css`, and `--javascript` options
363
- for `rails new` take different arguments. This change validates them.
269
+ *Jerome Dalbert*, *Haroon Ahmed*
364
270
 
365
- *Tony Drake*, *Akhil G Krishnan*, *Petrik de Heus*
271
+ * Deprecate `bin/rake stats` in favor of `bin/rails stats`.
366
272
 
367
- * Conditionally print `$stdout` when invoking `run_generator`.
273
+ *Juan Vásquez*
368
274
 
369
- In an effort to improve the developer experience when debugging
370
- generator tests, we add the ability to conditionally print `$stdout`
371
- instead of capturing it.
275
+ * Add internal page `/rails/info/notes`, that displays the same information as `bin/rails notes`.
372
276
 
373
- This allows for calls to `binding.irb` and `puts` work as expected.
277
+ *Deepak Mahakale*
374
278
 
375
- ```sh
376
- RAILS_LOG_TO_STDOUT=true ./bin/test test/generators/actions_test.rb
377
- ```
279
+ * Add Rubocop and GitHub Actions to plugin generator.
280
+ This can be skipped using --skip-rubocop and --skip-ci.
378
281
 
379
- *Steve Polito*
282
+ *Chris Oliver*
380
283
 
381
- * Remove the option `config.public_file_server.enabled` from the generators
382
- for all environments, as the value is the same in all environments.
284
+ * Use Kamal for deployment by default, which includes generating a Rails-specific config/deploy.yml.
285
+ This can be skipped using --skip-kamal. See more: https://kamal-deploy.org/
383
286
 
384
- *Adrian Hirt*
287
+ *DHH*
385
288
 
386
- Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/railties/CHANGELOG.md) for previous changes.
289
+ Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/railties/CHANGELOG.md) for previous 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 = []
@@ -110,7 +110,7 @@ module Minitest
110
110
  # minitest-reporters, maxitest, and others.
111
111
  def self.plugin_rails_init(options)
112
112
  # Don't mess with Minitest unless RAILS_ENV is set
113
- return unless ENV["RAILS_ENV"]
113
+ return unless ENV["RAILS_ENV"] || ENV["RAILS_MINITEST_PLUGIN"]
114
114
 
115
115
  unless options[:full_backtrace]
116
116
  # Plugin can run without Rails loaded, check before filtering.
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "fileutils"
4
- require "set"
5
4
  require "active_support/notifications"
6
5
  require "active_support/dependencies"
7
6
  require "active_support/descendants_tracker"
@@ -60,9 +59,7 @@ module Rails
60
59
  end
61
60
  else
62
61
  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
62
+ Rails.logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
66
63
  end
67
64
  end
68
65