railties 7.2.3.2 → 8.0.0.beta1

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