railties 7.2.3 → 8.0.5

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