railties 7.1.3.4 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +128 -775
  3. data/lib/minitest/rails_plugin.rb +6 -3
  4. data/lib/rails/all.rb +1 -3
  5. data/lib/rails/api/task.rb +6 -4
  6. data/lib/rails/application/bootstrap.rb +5 -7
  7. data/lib/rails/application/configuration.rb +81 -43
  8. data/lib/rails/application/default_middleware_stack.rb +4 -0
  9. data/lib/rails/application/dummy_config.rb +2 -2
  10. data/lib/rails/application/finisher.rb +9 -3
  11. data/lib/rails/application/routes_reloader.rb +16 -2
  12. data/lib/rails/application.rb +27 -86
  13. data/lib/rails/backtrace_cleaner.rb +19 -4
  14. data/lib/rails/cli.rb +0 -1
  15. data/lib/rails/code_statistics.rb +128 -86
  16. data/lib/rails/code_statistics_calculator.rb +78 -76
  17. data/lib/rails/command/helpers/editor.rb +1 -1
  18. data/lib/rails/command.rb +0 -6
  19. data/lib/rails/commands/app/update_command.rb +94 -0
  20. data/lib/rails/commands/boot/boot_command.rb +14 -0
  21. data/lib/rails/commands/console/console_command.rb +2 -21
  22. data/lib/rails/commands/console/irb_console.rb +128 -0
  23. data/lib/rails/commands/credentials/USAGE +4 -4
  24. data/lib/rails/commands/credentials/credentials_command.rb +7 -3
  25. data/lib/rails/commands/dbconsole/dbconsole_command.rb +21 -30
  26. data/lib/rails/commands/dev/dev_command.rb +1 -1
  27. data/lib/rails/commands/devcontainer/devcontainer_command.rb +40 -0
  28. data/lib/rails/commands/rake/rake_command.rb +1 -1
  29. data/lib/rails/commands/runner/runner_command.rb +14 -3
  30. data/lib/rails/commands/server/server_command.rb +5 -3
  31. data/lib/rails/commands/stats/stats_command.rb +19 -0
  32. data/lib/rails/commands/test/test_command.rb +2 -0
  33. data/lib/rails/configuration.rb +10 -1
  34. data/lib/rails/console/methods.rb +7 -0
  35. data/lib/rails/dev_caching.rb +2 -2
  36. data/lib/rails/engine/configuration.rb +3 -1
  37. data/lib/rails/engine/lazy_route_set.rb +114 -0
  38. data/lib/rails/engine.rb +16 -12
  39. data/lib/rails/gem_version.rb +4 -4
  40. data/lib/rails/generators/actions.rb +3 -3
  41. data/lib/rails/generators/app_base.rb +115 -68
  42. data/lib/rails/generators/base.rb +1 -1
  43. data/lib/rails/generators/database.rb +263 -71
  44. data/lib/rails/generators/erb/authentication/authentication_generator.rb +15 -0
  45. data/lib/rails/generators/erb/authentication/templates/app/views/passwords/edit.html.erb +9 -0
  46. data/lib/rails/generators/erb/authentication/templates/app/views/passwords/new.html.erb +8 -0
  47. data/lib/rails/generators/erb/authentication/templates/app/views/sessions/new.html.erb +11 -0
  48. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +2 -0
  49. data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +2 -0
  50. data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +2 -0
  51. data/lib/rails/generators/generated_attribute.rb +42 -12
  52. data/lib/rails/generators/migration.rb +3 -3
  53. data/lib/rails/generators/rails/app/app_generator.rb +75 -54
  54. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +33 -17
  55. data/lib/rails/generators/rails/app/templates/Gemfile.tt +38 -23
  56. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +6 -11
  57. data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +4 -0
  58. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +17 -3
  59. data/lib/rails/generators/rails/app/templates/app/views/pwa/manifest.json.erb.tt +22 -0
  60. data/lib/rails/generators/rails/app/templates/app/views/pwa/service-worker.js +26 -0
  61. data/lib/rails/generators/rails/app/templates/bin/brakeman.tt +6 -0
  62. data/lib/rails/generators/rails/app/templates/bin/dev.tt +1 -0
  63. data/lib/rails/generators/rails/app/templates/bin/rubocop.tt +7 -0
  64. data/lib/rails/generators/rails/app/templates/bin/setup.tt +6 -5
  65. data/lib/rails/generators/rails/app/templates/bin/thrust.tt +4 -0
  66. data/lib/rails/generators/rails/app/templates/config/application.rb.tt +1 -1
  67. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +26 -3
  68. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +30 -0
  69. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +47 -0
  70. data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +26 -3
  71. data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +128 -0
  72. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +22 -26
  73. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +36 -48
  74. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +7 -18
  75. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +0 -7
  76. data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +1 -1
  77. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +30 -0
  78. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +35 -27
  79. data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +6 -0
  80. data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +7 -1
  81. data/lib/rails/generators/rails/app/templates/dockerignore.tt +20 -2
  82. data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +144 -0
  83. data/lib/rails/generators/rails/app/templates/github/dependabot.yml +12 -0
  84. data/lib/rails/generators/rails/app/templates/gitignore.tt +4 -5
  85. data/lib/rails/generators/rails/app/templates/kamal-secrets.tt +17 -0
  86. data/lib/rails/generators/rails/app/templates/public/400.html +114 -0
  87. data/lib/rails/generators/rails/app/templates/public/404.html +113 -66
  88. data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +114 -0
  89. data/lib/rails/generators/rails/app/templates/public/422.html +113 -66
  90. data/lib/rails/generators/rails/app/templates/public/500.html +113 -65
  91. data/lib/rails/generators/rails/app/templates/public/icon.png +0 -0
  92. data/lib/rails/generators/rails/app/templates/public/icon.svg +3 -0
  93. data/lib/rails/generators/rails/app/templates/rubocop.yml.tt +8 -0
  94. data/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb.tt +1 -1
  95. data/lib/rails/generators/rails/authentication/USAGE +6 -0
  96. data/lib/rails/generators/rails/authentication/authentication_generator.rb +58 -0
  97. data/lib/rails/generators/rails/authentication/templates/app/channels/application_cable/connection.rb.tt +16 -0
  98. data/lib/rails/generators/rails/authentication/templates/app/controllers/concerns/authentication.rb.tt +52 -0
  99. data/lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt +33 -0
  100. data/lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt +21 -0
  101. data/lib/rails/generators/rails/authentication/templates/app/mailers/passwords_mailer.rb.tt +6 -0
  102. data/lib/rails/generators/rails/authentication/templates/app/models/current.rb.tt +4 -0
  103. data/lib/rails/generators/rails/authentication/templates/app/models/session.rb.tt +3 -0
  104. data/lib/rails/generators/rails/authentication/templates/app/models/user.rb.tt +6 -0
  105. data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt +4 -0
  106. data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt +2 -0
  107. data/lib/rails/generators/rails/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb.tt +7 -0
  108. data/lib/rails/generators/rails/controller/controller_generator.rb +1 -1
  109. data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +4 -0
  110. data/lib/rails/generators/rails/db/system/change/change_generator.rb +132 -21
  111. data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +176 -0
  112. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +3 -0
  113. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt +47 -0
  114. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +37 -0
  115. data/lib/rails/generators/rails/migration/migration_generator.rb +4 -0
  116. data/lib/rails/generators/rails/plugin/plugin_generator.rb +47 -16
  117. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +2 -2
  118. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +6 -2
  119. data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +2 -0
  120. data/lib/rails/generators/rails/plugin/templates/bin/rubocop.tt +7 -0
  121. data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +103 -0
  122. data/lib/rails/generators/rails/plugin/templates/github/dependabot.yml +12 -0
  123. data/lib/rails/generators/rails/plugin/templates/rubocop.yml.tt +8 -0
  124. data/lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb.tt +1 -1
  125. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +2 -2
  126. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -2
  127. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +3 -3
  128. data/lib/rails/generators/rails/script/USAGE +18 -0
  129. data/lib/rails/generators/rails/script/script_generator.rb +18 -0
  130. data/lib/rails/generators/rails/script/templates/script.rb.tt +3 -0
  131. data/lib/rails/generators/test_unit/authentication/authentication_generator.rb +14 -0
  132. data/lib/rails/generators/test_unit/authentication/templates/test/fixtures/users.yml.tt +9 -0
  133. data/lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt +7 -0
  134. data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +6 -4
  135. data/lib/rails/generators/test_unit/mailer/templates/preview.rb.tt +3 -2
  136. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +15 -1
  137. data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +2 -2
  138. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +2 -2
  139. data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +2 -0
  140. data/lib/rails/generators/test_unit/system/templates/application_system_test_case.rb.tt +1 -1
  141. data/lib/rails/generators/testing/assertions.rb +20 -0
  142. data/lib/rails/generators/testing/behavior.rb +7 -6
  143. data/lib/rails/generators.rb +7 -2
  144. data/lib/rails/health_controller.rb +1 -1
  145. data/lib/rails/info.rb +2 -2
  146. data/lib/rails/info_controller.rb +10 -2
  147. data/lib/rails/mailers_controller.rb +14 -1
  148. data/lib/rails/paths.rb +2 -2
  149. data/lib/rails/pwa_controller.rb +15 -0
  150. data/lib/rails/rack/logger.rb +15 -7
  151. data/lib/rails/rack/silence_request.rb +33 -0
  152. data/lib/rails/rack.rb +1 -0
  153. data/lib/rails/railtie/configurable.rb +2 -2
  154. data/lib/rails/railtie.rb +15 -16
  155. data/lib/rails/source_annotation_extractor.rb +31 -14
  156. data/lib/rails/tasks/framework.rake +0 -26
  157. data/lib/rails/tasks/statistics.rake +13 -28
  158. data/lib/rails/tasks/tmp.rake +1 -1
  159. data/lib/rails/templates/layouts/application.html.erb +1 -1
  160. data/lib/rails/templates/rails/info/notes.html.erb +65 -0
  161. data/lib/rails/templates/rails/mailers/email.html.erb +12 -8
  162. data/lib/rails/templates/rails/welcome/index.html.erb +4 -2
  163. data/lib/rails/test_help.rb +2 -4
  164. data/lib/rails/test_unit/reporter.rb +8 -2
  165. data/lib/rails/test_unit/runner.rb +27 -2
  166. data/lib/rails/test_unit/test_parser.rb +48 -0
  167. data/lib/rails.rb +7 -4
  168. metadata +77 -45
  169. data/lib/rails/app_updater.rb +0 -40
  170. data/lib/rails/commands/secrets/USAGE +0 -61
  171. data/lib/rails/commands/secrets/secrets_command.rb +0 -47
  172. data/lib/rails/console/app.rb +0 -35
  173. data/lib/rails/console/helpers.rb +0 -19
  174. data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -2
  175. data/lib/rails/generators/rails/app/templates/app/channels/application_cable/channel.rb.tt +0 -4
  176. data/lib/rails/generators/rails/app/templates/app/channels/application_cable/connection.rb.tt +0 -4
  177. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +0 -68
  178. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +0 -54
  179. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +0 -70
  180. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +0 -24
  181. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +0 -62
  182. data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +0 -53
  183. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +0 -284
  184. data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +0 -13
  185. data/lib/rails/generators/rails/app/templates/public/apple-touch-icon-precomposed.png +0 -0
  186. data/lib/rails/generators/rails/app/templates/public/apple-touch-icon.png +0 -0
  187. data/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
  188. data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +0 -13
  189. data/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js.tt +0 -10
  190. data/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js.tt +0 -6
  191. data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt +0 -17
  192. data/lib/rails/ruby_version_check.rb +0 -17
  193. data/lib/rails/secrets.rb +0 -110
data/CHANGELOG.md CHANGED
@@ -1,893 +1,246 @@
1
- ## Rails 7.1.3.4 (June 04, 2024) ##
1
+ ## Rails 8.0.1 (December 13, 2024) ##
2
2
 
3
- * No changes.
3
+ * Skip generation system tests related code for CI when `--skip-system-test` is given.
4
4
 
5
+ *fatkodima*
5
6
 
6
- ## Rails 7.1.3.3 (May 16, 2024) ##
7
-
8
- * No changes.
7
+ * Don't add bin/thrust if thruster is not in Gemfile.
9
8
 
9
+ *Étienne Barrié*
10
10
 
11
- ## Rails 7.1.3.2 (February 21, 2024) ##
11
+ * Don't install a package for system test when applications don't use it.
12
12
 
13
- * No changes.
13
+ *y-yagi*
14
14
 
15
15
 
16
- ## Rails 7.1.3.1 (February 21, 2024) ##
16
+ ## Rails 8.0.0.1 (December 10, 2024) ##
17
17
 
18
18
  * No changes.
19
19
 
20
20
 
21
- ## Rails 7.1.3 (January 16, 2024) ##
22
-
23
- * Make sure `config.after_routes_loaded` hook runs on boot.
24
-
25
- *Rafael Mendonça França*
26
-
27
- * Fix `config.log_level` not being respected when using a `BroadcastLogger`
28
-
29
- *Édouard Chin*
30
-
31
- * Fix isolated engines to take `ActiveRecord::Base.table_name_prefix` into consideration.
32
- This will allow for engine defined models, such as inside Active Storage, to respect
33
- Active Record table name prefix configuration.
34
-
35
- *Chedli Bourguiba*
36
-
37
- * The `bin/rails app:template` command will no longer add potentially unwanted
38
- gem platforms via `bundle lock --add-platform=...` commands.
39
-
40
- *Jonathan Hefner*
41
-
42
-
43
- ## Rails 7.1.2 (November 10, 2023) ##
44
-
45
- * Fix running `db:system:change` when app has no Dockerfile.
46
-
47
- *Hartley McGuire*
48
-
49
- * If you accessed `config.eager_load_paths` and friends, later changes to
50
- `config.paths` were not reflected in the expected auto/eager load paths.
51
- Now, they are.
52
-
53
- This bug has been latent since Rails 3.
54
-
55
- Fixes #49629.
56
-
57
- *Xavier Noria*
58
-
59
- ## Rails 7.1.1 (October 11, 2023) ##
60
-
61
- * Ensures the Rails generated Dockerfile uses correct ruby version and matches Gemfile.
62
-
63
- *Abhay Nikam*
64
-
65
-
66
- ## Rails 7.1.0 (October 05, 2023) ##
21
+ ## Rails 8.0.0 (November 07, 2024) ##
67
22
 
68
23
  * No changes.
69
24
 
70
25
 
71
- ## Rails 7.1.0.rc2 (October 01, 2023) ##
72
-
73
- * Always set the Rails logger to be an instance of `ActiveSupport::BroadcastLogger`.
74
-
75
- *Edouard Chin*
76
-
77
-
78
- ## Rails 7.1.0.rc1 (September 27, 2023) ##
79
-
80
- * Require `concurrent-ruby` in `config/puma.rb` so that Puma can boot in
81
- production when `WEB_CONCURRENCY` is not explicitly specified.
82
-
83
- Fixes #49323.
84
-
85
- *Matt Brictson*
86
-
87
- * Raise error when generating attribute with dangerous name.
88
-
89
- The following will now raise an error as `save` and `hash` are already
90
- defined by Active Record.
91
-
92
- ```bash
93
- $ bin/rails generate model Post save
94
- $ bin/rails generate model Post hash
95
- ```
96
-
97
- *Petrik de Heus*
98
-
99
-
100
- ## Rails 7.1.0.beta1 (September 13, 2023) ##
101
-
102
- * Add ability to show slow tests to the test runner
103
-
104
- ```bash
105
- $ bin/test --profile # additionally prints 10 (default) slowest tests
106
- # or
107
- $ bin/test --profile 20 # prints 20 slowest tests
108
- ```
109
-
110
- *fatkodima*
111
-
112
- * `rails new --javascript` generator now supports Bun
113
-
114
- ```bash
115
- $ rails new my_new_app --javascript=bun
116
- ```
117
-
118
- *Jason Meller*
119
-
120
- * bin/setup uses `bun` instead of `yarn` when generated an app with bun
121
-
122
- Use `bun install` on `bin/setup` when using `bun`.
123
-
124
- *Cadu Ribeiro*
125
-
126
- * `config/application.rb` now includes
127
-
128
- ```ruby
129
- config.autoload_lib(ignore: %w(assets tasks))
130
- ```
131
-
132
- In practice, this means that new 7.1 applications autoload from `lib` out of the box.
133
-
134
- *Xavier Noria*
135
-
136
- * Add an option to start rails console in sandbox mode by default
137
-
138
- `sandbox_by_default` option is added to start rails console in sandbox
139
- mode by default. With this option turned on, `--no-sandbox` must be
140
- specified to start rails in non-sandbox mode.
141
-
142
- Note that this option is ignored when rails environment is development
143
- or test.
144
-
145
- *Shouichi Kamiya*
146
-
147
- * Omit `webdrivers` gem dependency from `Gemfile` template
148
-
149
- *Sean Doyle*
150
-
151
- * Support filtering tests by line ranges
152
-
153
- The new syntax allows you to filter tests by line ranges. For example, the
154
- following command runs tests from line 10 to 20.
155
-
156
- ```bash
157
- $ rails test test/models/user_test.rb:10-20
158
- ```
159
-
160
- *Shouichi Kamiya*, *Seonggi Yang*, *oljfte*, *Ryohei UEDA*
161
-
162
- * Update default scaffold templates to set 303 (See Other) as status code
163
- on redirect for the update action for XHR requests other than GET or POST
164
- to avoid issues (e.g browsers trying to follow the redirect using the
165
- original request method resulting in double PATCH/PUT)
166
-
167
- *Guillermo Iguaran*
168
-
169
- * The new `config.autoload_lib_once` is similar to `config.autoload_lib`,
170
- except that it adds `lib` to `config.autoload_once_paths` instead.
171
-
172
- By calling `config.autoload_lib_once`, classes and modules in `lib` can be
173
- autoloaded, even from application initializers, but won't be reloaded.
174
-
175
- Please, see further details in the [autoloading
176
- guide](https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html).
177
-
178
- *Xavier Noria*
179
-
180
- * Add `config.action_dispatch.debug_exception_log_level` to configure the log
181
- level used by `ActionDispatch::DebugExceptions`.
182
-
183
- The default is `:fatal`, but with `load_defaults "7.1"` the default will be
184
- `:error`.
185
-
186
- *Hartley McGuire*
187
-
188
- * Add `DATABASE` option to `railties:install:migrations`
189
-
190
- This allows you to specify which database the migrations should be copied to
191
- when running `rails railties:install:migrations`.
192
-
193
- ```bash
194
- $ rails railties:install:migrations DATABASE=animals
195
- ```
196
-
197
- *Matthew Hirst*
198
-
199
- * The new method `config.autoload_lib(ignore:)` provides a simple way to
200
- autoload from `lib`:
201
-
202
- ```ruby
203
- # config/application.rb
204
- config.autoload_lib(ignore: %w(assets tasks))
205
- ```
206
-
207
- Please, see further details in the [autoloading
208
- guide](https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html).
209
-
210
- *Xavier Noria*
211
-
212
- * Don't show secret_key_base for `Rails.application.config#inspect`.
213
-
214
- Before:
215
-
216
- ```ruby
217
- Rails.application.config.inspect
218
- "#<Rails::Application::Configuration:0x00000001132b02a0 @root=... @secret_key_base=\"b3c631c314c0bbca50c1b2843150fe33\" ... >"
219
- ```
220
-
221
- After:
222
-
223
- ```ruby
224
- Rails.application.config.inspect
225
- "#<Rails::Application::Configuration:0x00000001132b02a0>"
226
- ```
227
-
228
- *Petrik de Heus*
229
-
230
- * Deprecate calling `Rails.application.secrets`.
231
-
232
- Rails `secrets` have been deprecated in favor of `credentials`.
233
- Calling `Rails.application.secrets` should show a deprecation warning.
234
-
235
- *Petrik de Heus*
236
-
237
- * Store `secret_key_base` in `Rails.config` for local environments.
238
-
239
- Rails `secrets` have been deprecated in favor of `credentials`.
240
- For the local environments the `secret_key_base` is now stored in
241
- `Rails.config.secret_key_base` instead of the soft deprecated
242
- `Rails.application.secrets.secret_key_base`.
243
-
244
- *Petrik de Heus*
245
-
246
- * Enable force_ssl=true in production by default: Force all access to the app over SSL,
247
- use Strict-Transport-Security, and use secure cookies
248
-
249
- *Justin Searls*, *Aaron Patterson*, *Guillermo Iguaran*, *Vinícius Bispo*
250
-
251
- * Add engine's draw paths to application route set, so that the application
252
- can draw route files defined in engine paths.
253
-
254
- *Gannon McGibbon*
255
-
256
- * Support `VISUAL` environment variable for commands which open an editor,
257
- and prefer it over `EDITOR`.
258
-
259
- *Summer ☀️*
260
-
261
- * Add engine's `test/fixtures` path to `fixture_paths` in `on_load` hook if
262
- path exists and is under the Rails application root.
263
-
264
- *Chris Salzberg*
265
-
266
- * `bin/rails app:template` now runs `bundle install` and any `after_bundle`
267
- blocks after the template is executed.
268
-
269
- *Jonathan Hefner* and *Gerry Caulfield*
270
-
271
- * Enable passing column size to migration generator
272
-
273
- Previously you could pass a limit to the migration generator:
274
-
275
- `rails generate migration CreateAuthor name:text{65535}`
276
-
277
- Now, a size attribute can be passed to the migration generator:
278
-
279
- `rails generate migration CreateAuthor name:text{medium}`
280
-
281
- This generates a migration which includes the size attribute:
282
-
283
- ```ruby
284
- class CreateAuthor < ActiveRecord::Migration[7.1]
285
- def change
286
- create_table :authors do |t|
287
- t.text :name, size: :medium
288
- end
289
- end
290
- end
291
- ```
292
-
293
- *Josh Broughton*, *Hartley McGuire*
294
-
295
- * Trying to set a config key with the same name of a method now raises:
296
-
297
- ```ruby
298
- config.load_defaults = 7.0
299
- # NoMethodError: Cannot assign to `load_defaults`, it is a configuration method
300
- ```
301
-
302
- *Xavier Noria*
303
-
304
- * Deprecate `secrets:edit/show` and remove `secrets:setup`
305
-
306
- `bin/rails secrets:setup` has been deprecated since Rails 5.2 in favor of
307
- credentials. This command has been removed.
308
-
309
- `bin/rails secrets:show` and `bin/rails secrets:edit` have been deprecated
310
- in favor of credentials.
311
-
312
- Run `bin/rails credentials:help` for more information
313
-
314
- *Petrik de Heus*
315
-
316
- * `bin/rails --help` will now list only framework and plugin commands. Rake
317
- tasks defined in `lib/tasks/*.rake` files will no longer be included. For a
318
- list of those tasks, use `rake -T`.
319
-
320
- *Jonathan Hefner*
321
-
322
- * Allow calling `bin/rails restart` outside of app directory.
323
-
324
- The following would previously fail with a "No Rakefile found" error.
325
-
326
- ```bash
327
- $ blog/bin/rails restart
328
- ```
329
-
330
- *Petrik de Heus*
331
-
332
- * Support prerelease rubies in Gemfile template if RubyGems version is 3.3.13 or higher.
26
+ ## Rails 8.0.0.rc2 (October 30, 2024) ##
333
27
 
334
- *Yasuo Honda*, *David Rodríguez*
28
+ * Fix incorrect database.yml with `skip_solid`.
335
29
 
336
- * Autoloading setup honors root directories manually set by the user.
30
+ *Joé Dupuis*
337
31
 
338
- This is relevant for custom namespaces. For example, if you'd like classes
339
- and modules under `app/services` to be defined in the `Services` namespace
340
- without an extra `app/services/services` directory, this is now enough:
32
+ * Set `Regexp.timeout` to `1`s by default to improve security over Regexp Denial-of-Service attacks.
341
33
 
342
- ```ruby
343
- # config/initializers/autoloading.rb
34
+ *Rafael Mendonça França*
344
35
 
345
- # The namespace has to exist.
346
- #
347
- # In this example we define the module on the spot. Could also be created
348
- # elsewhere and its definition loaded here with an ordinary `require`. In
349
- # any case, `push_dir` expects a class or module object.
350
- module Services; end
351
36
 
352
- Rails.autoloaders.main.push_dir("#{Rails.root}/app/services", namespace: Services)
353
- ```
37
+ ## Rails 8.0.0.rc1 (October 19, 2024) ##
354
38
 
355
- Check the autoloading guide for further details.
39
+ * Remove deprecated support to extend Rails console through `Rails::ConsoleMethods`.
356
40
 
357
- *Xavier Noria*
41
+ *Rafael Mendonça França*
358
42
 
359
- * Railties now requires the irb gem as a dependency, which means when you install Rails, irb will also
360
- be installed as a gem. Rails will then use the installed version of irb for its console instead of
361
- relying on Ruby's built-in version.
362
- This ensures that Rails has access to the most up-to-date and reliable version of irb for its console.
43
+ * Remove deprecated file `rails/console/helpers`.
363
44
 
364
- *Stan Lo*
45
+ *Rafael Mendonça França*
365
46
 
366
- * Use infinitive form for all rails command descriptions verbs.
47
+ * Remove deprecated file `rails/console/app`.
367
48
 
368
- *Petrik de Heus*
49
+ *Rafael Mendonça França*
369
50
 
370
- * Credentials commands (e.g. `bin/rails credentials:edit`) now respect
371
- `config.credentials.content_path` and `config.credentials.key_path` when set
372
- in `config/application.rb` or `config/environments/#{Rails.env}.rb`.
51
+ * Remove deprecated `config.read_encrypted_secrets`.
373
52
 
374
- Before:
53
+ *Rafael Mendonça França*
375
54
 
376
- * `bin/rails credentials:edit` ignored `RAILS_ENV`, and would always edit
377
- `config/credentials.yml.enc`.
55
+ * Add Kamal support for devcontainers
378
56
 
379
- * `bin/rails credentials:edit --environment foo` would create and edit
380
- `config/credentials/foo.yml.enc`.
57
+ Previously generated devcontainer could not use docker and therefore Kamal.
381
58
 
382
- * If `config.credentials.content_path` or `config.credentials.key_path`
383
- was set, `bin/rails credentials:edit` could not be used to edit the
384
- credentials. Editing credentials required using `bin/rails
385
- encrypted:edit path/to/credentials --key path/to/key`.
59
+ *Joé Dupuis*
386
60
 
387
- After:
388
61
 
389
- * `bin/rails credentials:edit` will edit the credentials file that the app
390
- would load for the current `RAILS_ENV`.
62
+ ## Rails 8.0.0.beta1 (September 26, 2024) ##
391
63
 
392
- * `bin/rails credentials:edit` respects `config.credentials.content_path`
393
- and `config.credentials.key_path` when set in `config/application.rb`
394
- or `config/environments/#{Rails.env}.rb`.
64
+ * Exit `rails g` with code 1 if generator could not be found.
395
65
 
396
- * `bin/rails credentials:edit --environment foo` will create and edit
397
- `config/credentials/foo.yml.enc` _if_ `config.credentials.content_path`
398
- has not been set for the `foo` environment. Ultimately, it will edit
399
- the credentials file that the app would load for the `foo` environment.
66
+ Previously `rails g` returned 0, which would make it harder to catch typos in scripts calling `rails g`.
400
67
 
401
- *Jonathan Hefner*
68
+ *Christopher Özbek*
402
69
 
403
- * Add descriptions for non-Rake commands when running `rails -h`.
70
+ * Remove `require_*` statements from application.css to align with the transition from Sprockets to Propshaft.
404
71
 
405
- *Petrik de Heus*
72
+ 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.
406
73
 
407
- * Show relevant commands when calling help
74
+ *Eduardo Alencar*
408
75
 
409
- When running `rails -h` or just `rails` outside a Rails application,
410
- Rails outputs all options for running the `rails new` command. This can be
411
- confusing to users when they probably want to see the common Rails commands.
76
+ * Do not include redis by default in generated Dev Containers.
412
77
 
413
- Instead, we should always show the common commands when running `rails -h`
414
- inside or outside a Rails application.
78
+ Now that applications use the Solid Queue and Solid Cache gems by default, we do not need to include redis
79
+ in the Dev Container. We will only include redis if `--skip-solid` is used when generating an app that uses
80
+ Active Job or Action Cable.
415
81
 
416
- As the relevant commands inside a Rails application differ from the
417
- commands outside an application, the help USAGE file has been split to
418
- show the most relevant commands for the context.
82
+ When generating a Dev Container for an existing app, we will not include redis if either of the solid gems
83
+ are in use.
419
84
 
420
- *Petrik de Heus*
85
+ *Andrew Novoselac*
421
86
 
422
- * Add Rails::HealthController#show and map it to /up for newly generated applications.
423
- Load balancers and uptime monitors all need a basic endpoint to tell whether the app is up.
424
- This is a good starting point that'll work in many situations.
87
+ * 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.
425
88
 
426
89
  *DHH*
427
90
 
428
- * Only use HostAuthorization middleware if `config.hosts` is not empty
429
-
430
- *Hartley McGuire*
431
-
432
- * Raise an exception when a `before_action`'s "only" or "except" filter
433
- options reference an action that doesn't exist. This will be enabled by
434
- default but can be overridden via config.
435
-
436
- ```ruby
437
- # config/environments/production.rb
438
- config.action_controller.raise_on_missing_callback_actions = false
439
- ```
440
-
441
- *Jess Bees*
442
-
443
- * Use physical processor count as the default Puma worker count in production.
444
- This can be overridden by setting `ENV["WEB_CONCURRENCY"]` or editing the
445
- generated "config/puma.rb" directly.
91
+ * 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.
446
92
 
447
93
  *DHH*
448
94
 
449
- * Add Docker files by default to new apps: Dockerfile, .dockerignore, bin/docker-entrypoint.
450
- These files can be skipped with `--skip-docker`. They're intended as a starting point for
451
- a production deploy of the application. Not intended for development (see Docked Rails for that).
452
-
453
- Example:
454
-
455
- ```bash
456
- $ docker build -t app .
457
- $ docker volume create app-storage
458
- $ docker run --rm -it -v app-storage:/rails/storage -p 3000:3000 --env RAILS_MASTER_KEY=<see config/master.key> app
459
- ```
460
-
461
- You can also start a console or a runner from this image:
462
-
463
- ```bash
464
- $ docker run --rm -it -v app-storage:/rails/storage --env RAILS_MASTER_KEY=<see config/master.key> app console
465
- ```
466
-
467
- To create a multi-platform image on Apple Silicon to deploy on AMD or Intel and push to Docker Hub for user/app:
468
-
469
- ```bash
470
- $ docker login -u <user>
471
- $ docker buildx create --use
472
- $ docker buildx build --push --platform=linux/amd64,linux/arm64 -t <user/image> .
473
- ```
474
-
475
- *DHH, Sam Ruby*
476
-
477
- * Add ENV["SECRET_KEY_BASE_DUMMY"] for starting production environment with a generated secret base key,
478
- which can be used to run tasks like `assets:precompile` without making the RAILS_MASTER_KEY available
479
- to the build process.
480
-
481
- Dockerfile layer example:
482
-
483
- ```
484
- RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile
485
- ```
95
+ * 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.
486
96
 
487
97
  *DHH*
488
98
 
489
- * Show descriptions for all commands in Rails help
490
-
491
- When calling `rails help` most commands missed their description. We now
492
- show the same descriptions as shown in `rails -T`.
493
-
494
- *Petrik de Heus*
495
-
496
- * Always generate the storage/ directory with rails new to ensure there's a stable place to
497
- put permanent files, and a single mount point for containers to map. Then default sqlite3 databases
498
- to live there instead of db/, which is only meant for configuration, not data.
99
+ * Add Rails::Rack::SilenceRequest middleware and use it via `config.silence_healthcheck_path = path`
100
+ to silence requests to "/up". This prevents the Kamal-required health checks from clogging up
101
+ the production logs.
499
102
 
500
103
  *DHH*
501
104
 
502
- * Rails console now disables `IRB`'s autocompletion feature in production by default.
105
+ * Introduce `mariadb-mysql` and `mariadb-trilogy` database options for `rails new`
503
106
 
504
- Setting `IRB_USE_AUTOCOMPLETE=true` can override this default.
107
+ When used with the `--devcontainer` flag, these options will use `mariadb` as the database for the
108
+ Dev Container. The original `mysql` and `trilogy` options will use `mysql`. Users who are not
109
+ generating a Dev Container do not need to use the new options.
505
110
 
506
- *Stan Lo*
111
+ *Andrew Novoselac*
507
112
 
508
- * Add `config.precompile_filter_parameters`, which enables precompilation of
509
- `config.filter_parameters` using `ActiveSupport::ParameterFilter.precompile_filters`.
510
- Precompilation can improve filtering performance, depending on the quantity
511
- and types of filters.
113
+ * Deprecate `::STATS_DIRECTORIES`.
512
114
 
513
- `config.precompile_filter_parameters` defaults to `true` for
514
- `config.load_defaults 7.1` and above.
115
+ The global constant `STATS_DIRECTORIES` has been deprecated in favor of
116
+ `Rails::CodeStatistics.register_directory`.
515
117
 
516
- *Jonathan Hefner*
517
-
518
- * Add `after_routes_loaded` hook to `Rails::Railtie::Configuration` for
519
- engines to add a hook to be called after application routes have been
520
- loaded.
118
+ Add extra directories with `Rails::CodeStatistics.register_directory(label, path)`:
521
119
 
522
120
  ```ruby
523
- MyEngine.config.after_routes_loaded do
524
- # code that must happen after routes have been loaded
525
- end
121
+ require "rails/code_statistics"
122
+ Rails::CodeStatistics.register_directory('My Directory', 'path/to/dir')
526
123
  ```
527
124
 
528
- *Chris Salzberg*
529
-
530
- * Send 303 See Other status code back for the destroy action on newly generated
531
- scaffold controllers.
532
-
533
- *Tony Drake*
534
-
535
- * Add `Rails.application.deprecators` as a central point to manage deprecators
536
- for an application.
125
+ *Petrik de Heus*
537
126
 
538
- Individual deprecators can be added and retrieved from the collection:
127
+ * Enable query log tags by default on development env
539
128
 
540
- ```ruby
541
- Rails.application.deprecators[:my_gem] = ActiveSupport::Deprecation.new("2.0", "MyGem")
542
- Rails.application.deprecators[:other_gem] = ActiveSupport::Deprecation.new("3.0", "OtherGem")
543
- ```
129
+ This can be used to trace troublesome SQL statements back to the application
130
+ code that generated these statements. It is also useful when using multiple
131
+ databases because the query logs can identify which database is being used.
544
132
 
545
- And the collection's configuration methods affect all deprecators in the
546
- collection:
133
+ *Matheus Richard*
547
134
 
548
- ```ruby
549
- Rails.application.deprecators.debug = true
135
+ * Defer route drawing to the first request, or when url_helpers are called
550
136
 
551
- Rails.application.deprecators[:my_gem].debug
552
- # => true
553
- Rails.application.deprecators[:other_gem].debug
554
- # => true
555
- ```
137
+ Executes the first routes reload in middleware, or when a route set's
138
+ url_helpers receives a route call / asked if it responds to a route.
139
+ Previously, this was executed unconditionally on boot, which can
140
+ slow down boot time unnecessarily for larger apps with lots of routes.
556
141
 
557
- Additionally, all deprecators in the collection can be silenced for the
558
- duration of a given block:
142
+ Environments like production that have `config.eager_load = true` will
143
+ continue to eagerly load routes on boot.
559
144
 
560
- ```ruby
561
- Rails.application.deprecators.silence do
562
- Rails.application.deprecators[:my_gem].warn # => silenced (no warning)
563
- Rails.application.deprecators[:other_gem].warn # => silenced (no warning)
564
- end
565
- ```
566
-
567
- *Jonathan Hefner*
568
-
569
- * Move dbconsole logic to Active Record connection adapter.
145
+ *Gannon McGibbon*
570
146
 
571
- Instead of hosting the connection logic in the command object, the
572
- database adapter should be responsible for connecting to a console session.
573
- This patch moves #find_cmd_and_exec to the adapter and exposes a new API to
574
- lookup the adapter class without instantiating it.
147
+ * Generate form helpers to use `textarea*` methods instead of `text_area*` methods
575
148
 
576
- *Gannon McGibbon*, *Paarth Madan*
149
+ *Sean Doyle*
577
150
 
578
- * Add `Rails.application.message_verifiers` as a central point to configure
579
- and create message verifiers for an application.
151
+ * Add authentication generator to give a basic start to an authentication system using database-tracked sessions and password reset.
580
152
 
581
- This allows applications to, for example, rotate old `secret_key_base`
582
- values:
153
+ Generate with...
583
154
 
584
- ```ruby
585
- config.before_initialize do |app|
586
- app.message_verifiers.rotate(secret_key_base: "old secret_key_base")
587
- end
588
155
  ```
589
-
590
- And for libraries to create preconfigured message verifiers:
591
-
592
- ```ruby
593
- ActiveStorage.verifier = Rails.application.message_verifiers["ActiveStorage"]
156
+ bin/rails generate authentication
594
157
  ```
595
158
 
596
- *Jonathan Hefner*
597
-
598
- * Support MySQL's ssl-mode option for the dbconsole command.
599
-
600
- Verifying the identity of the database server requires setting the ssl-mode
601
- option to VERIFY_CA or VERIFY_IDENTITY. This option was previously ignored
602
- for the dbconsole command.
603
-
604
- *Petrik de Heus*
605
-
606
- * Delegate application record generator description to orm hooked generator.
607
-
608
- *Gannon McGibbon*
159
+ Generated files:
609
160
 
610
- * Show BCC recipients when present in Action Mailer previews.
611
-
612
- *Akshay Birajdar*
613
-
614
- * Extend `routes --grep` to also filter routes by matching against path.
615
-
616
- Example:
617
-
618
- ```bash
619
- $ bin/rails routes --grep /cats/1
620
- Prefix Verb URI Pattern Controller#Action
621
- cat GET /cats/:id(.:format) cats#show
622
- PATCH /cats/:id(.:format) cats#update
623
- PUT /cats/:id(.:format) cats#update
624
- DELETE /cats/:id(.:format) cats#destroy
625
161
  ```
626
-
627
- *Orhan Toy*
628
-
629
- * Improve `rails runner` output when given a file path that doesn't exist.
630
-
631
- *Tekin Suleyman*
632
-
633
- * `config.allow_concurrency = false` now use a `Monitor` instead of a `Mutex`
634
-
635
- This allows to enable `config.active_support.executor_around_test_case` even
636
- when `config.allow_concurrency` is disabled.
637
-
638
- *Jean Boussier*
639
-
640
- * Add `routes --unused` option to detect extraneous routes.
641
-
642
- Example:
643
-
644
- ```bash
645
- $ bin/rails routes --unused
646
-
647
- Found 2 unused routes:
648
-
649
- Prefix Verb URI Pattern Controller#Action
650
- one GET /one(.:format) action#one
651
- two GET /two(.:format) action#two
162
+ app/models/current.rb
163
+ app/models/user.rb
164
+ app/models/session.rb
165
+ app/controllers/sessions_controller.rb
166
+ app/controllers/passwords_controller.rb
167
+ app/mailers/passwords_mailer.rb
168
+ app/views/sessions/new.html.erb
169
+ app/views/passwords/new.html.erb
170
+ app/views/passwords/edit.html.erb
171
+ app/views/passwords_mailer/reset.html.erb
172
+ app/views/passwords_mailer/reset.text.erb
173
+ db/migrate/xxxxxxx_create_users.rb
174
+ db/migrate/xxxxxxx_create_sessions.rb
175
+ test/mailers/previews/passwords_mailer_preview.rb
652
176
  ```
653
177
 
654
- *Gannon McGibbon*
178
+ *DHH*
655
179
 
656
- * Add `--parent` option to controller generator to specify parent class of job.
657
180
 
658
- Example:
181
+ * Add not-null type modifier to migration attributes.
659
182
 
660
- `bin/rails g controller admin/users --parent=admin_controller` generates:
183
+ Generating with...
661
184
 
662
- ```ruby
663
- class Admin::UsersController < AdminController
664
- # ...
665
- end
666
185
  ```
667
-
668
- *Gannon McGibbon*
669
-
670
- * In-app custom credentials templates are now supported. When a credentials
671
- file does not exist, `rails credentials:edit` will now try to use
672
- `lib/templates/rails/credentials/credentials.yml.tt` to generate the
673
- credentials file, before falling back to the default template.
674
-
675
- This allows e.g. an open-source Rails app (which would not include encrypted
676
- credentials files in its repo) to include a credentials template, so that
677
- users who install the app will get a custom pre-filled credentials file when
678
- they run `rails credentials:edit`.
679
-
680
- *Jonathan Hefner*
681
-
682
- * Except for `dev` and `test` environments, newly generated per-environment
683
- credentials files (e.g. `config/credentials/production.yml.enc`) now include
684
- a `secret_key_base` for convenience, just as `config/credentials.yml.enc`
685
- does.
686
-
687
- *Jonathan Hefner*
688
-
689
- * `--no-*` options now work with the app generator's `--minimal` option, and
690
- are both comprehensive and precise. For example:
691
-
692
- ```bash
693
- $ rails new my_cool_app --minimal
694
- Based on the specified options, the following options will also be activated:
695
-
696
- --skip-active-job [due to --minimal]
697
- --skip-action-mailer [due to --skip-active-job, --minimal]
698
- --skip-active-storage [due to --skip-active-job, --minimal]
699
- --skip-action-mailbox [due to --skip-active-storage, --minimal]
700
- --skip-action-text [due to --skip-active-storage, --minimal]
701
- --skip-javascript [due to --minimal]
702
- --skip-hotwire [due to --skip-javascript, --minimal]
703
- --skip-action-cable [due to --minimal]
704
- --skip-bootsnap [due to --minimal]
705
- --skip-dev-gems [due to --minimal]
706
- --skip-system-test [due to --minimal]
707
-
708
- ...
709
-
710
- $ rails new my_cool_app --minimal --no-skip-active-storage
711
- Based on the specified options, the following options will also be activated:
712
-
713
- --skip-action-mailer [due to --minimal]
714
- --skip-action-mailbox [due to --minimal]
715
- --skip-action-text [due to --minimal]
716
- --skip-javascript [due to --minimal]
717
- --skip-hotwire [due to --skip-javascript, --minimal]
718
- --skip-action-cable [due to --minimal]
719
- --skip-bootsnap [due to --minimal]
720
- --skip-dev-gems [due to --minimal]
721
- --skip-system-test [due to --minimal]
722
-
723
- ...
186
+ bin/rails generate migration CreateUsers email_address:string!:uniq password_digest:string!
724
187
  ```
725
188
 
726
- *Brad Trick* and *Jonathan Hefner*
727
-
728
- * Add `--skip-dev-gems` option to app generator to skip adding development
729
- gems (like `web-console`) to the Gemfile.
730
-
731
- *Brad Trick*
732
-
733
- * Skip Active Storage and Action Mailer if Active Job is skipped.
734
-
735
- *Étienne Barrié*
736
-
737
- * Correctly check if frameworks are disabled when running app:update.
738
-
739
- *Étienne Barrié* and *Paulo Barros*
740
-
741
- * Delegate model generator description to orm hooked generator.
742
-
743
- *Gannon McGibbon*
744
-
745
- * Execute `rails runner` scripts inside the executor.
746
-
747
- Enables error reporting, query cache, etc.
748
-
749
- *Jean Boussier*
750
-
751
- * Avoid booting in development then test for test tasks.
752
-
753
- Running one of the rails test subtasks (e.g. test:system, test:models) would
754
- go through Rake and cause the app to be booted twice. Now all the test:*
755
- subtasks are defined as Thor tasks and directly load the test environment.
756
-
757
- *Étienne Barrié*
758
-
759
- * Deprecate `Rails::Generators::Testing::Behaviour` in favor of `Rails::Generators::Testing::Behavior`.
760
-
761
- *Gannon McGibbon*
762
-
763
- * Allow configuration of logger size for local and test environments
764
-
765
- `config.log_file_size`
766
-
767
- Defaults to `100` megabytes.
768
-
769
- *Bernie Chiu*
770
-
771
- * Enroll new apps in decrypted diffs of credentials by default. This behavior
772
- can be opted out of with the app generator's `--skip-decrypted-diffs` flag.
773
-
774
- *Jonathan Hefner*
775
-
776
- * Support declarative-style test name filters with `bin/rails test`.
777
-
778
- This makes it possible to run a declarative-style test such as:
189
+ Produces:
779
190
 
780
191
  ```ruby
781
- class MyTest < ActiveSupport::TestCase
782
- test "does something" do
783
- # ...
192
+ class CreateUsers < ActiveRecord::Migration[8.0]
193
+ def change
194
+ create_table :users do |t|
195
+ t.string :email_address, null: false
196
+ t.string :password_digest, null: false
197
+
198
+ t.timestamps
199
+ end
200
+ add_index :users, :email_address, unique: true
784
201
  end
785
202
  end
786
203
  ```
787
204
 
788
- Using its declared name:
789
-
790
- ```bash
791
- $ bin/rails test test/my_test.rb -n "does something"
792
- ```
793
-
794
- Instead of having to specify its expanded method name:
795
-
796
- ```bash
797
- $ bin/rails test test/my_test.rb -n test_does_something
798
- ```
799
-
800
- *Jonathan Hefner*
801
-
802
- * Add `--js` and `--skip-javascript` options to `rails new`
803
-
804
- `--js` alias to `rails new --javascript ...`
805
-
806
- Same as `-j`, e.g. `rails new --js esbuild ...`
807
-
808
- `--skip-js` alias to `rails new --skip-javascript ...`
809
-
810
- Same as `-J`, e.g. `rails new --skip-js ...`
811
-
812
- *Dorian Marié*
813
-
814
- * Allow relative paths with leading dot slash to be passed to `rails test`.
815
-
816
- Fix `rails test ./test/model/post_test.rb` to run a single test file.
817
-
818
- *Shouichi Kamiya* and *oljfte*
819
-
820
- * Deprecate `config.enable_dependency_loading`. This flag addressed a limitation of the `classic` autoloader and has no effect nowadays. To fix this deprecation, please just delete the reference.
821
-
822
- *Xavier Noria*
823
-
824
- * Define `config.enable_reloading` to be `!config.cache_classes` for a more intuitive name. While `config.enable_reloading` and `config.reloading_enabled?` are preferred from now on, `config.cache_classes` is supported for backwards compatibility.
825
-
826
- *Xavier Noria*
827
-
828
- * Add JavaScript dependencies installation on bin/setup
829
-
830
- Add `yarn install` to bin/setup when using esbuild, webpack, or rollout.
831
-
832
- *Carlos Ribeiro*
205
+ *DHH*
833
206
 
834
- * Use `controller_class_path` in `Rails::Generators::NamedBase#route_url`
207
+ * Add a `script` folder to applications, and a scripts generator.
835
208
 
836
- The `route_url` method now returns the correct path when generating
837
- a namespaced controller with a top-level model using `--model-name`.
209
+ The new `script` folder is meant to hold one-off or general purpose scripts,
210
+ such as data migration scripts, cleanup scripts, etc.
838
211
 
839
- Previously, when running this command:
212
+ A new script generator allows you to create such scripts:
840
213
 
841
- ```bash
842
- $ bin/rails generate scaffold_controller Admin/Post --model-name Post
843
214
  ```
844
-
845
- the comments above the controller action would look like:
846
-
847
- ``` ruby
848
- # GET /posts
849
- def index
850
- @posts = Post.all
851
- end
215
+ bin/rails generate script my_script
216
+ bin/rails generate script data/backfill
852
217
  ```
853
218
 
854
- afterwards, they now look like this:
219
+ You can run the generated script using:
855
220
 
856
- ``` ruby
857
- # GET /admin/posts
858
- def index
859
- @posts = Post.all
860
- end
221
+ ```
222
+ bundle exec ruby script/my_script.rb
223
+ bundle exec ruby script/data/backfill.rb
861
224
  ```
862
225
 
863
- Fixes #44662.
864
-
865
- *Andrew White*
866
-
867
- * No longer add autoloaded paths to `$LOAD_PATH`.
868
-
869
- This means it won't be possible to load them with a manual `require` call, the class or module can be referenced instead.
870
-
871
- Reducing the size of `$LOAD_PATH` speed-up `require` calls for apps not using `bootsnap`, and reduce the
872
- size of the `bootsnap` cache for the others.
226
+ *Jerome Dalbert*, *Haroon Ahmed*
873
227
 
874
- *Jean Boussier*
228
+ * Deprecate `bin/rake stats` in favor of `bin/rails stats`.
875
229
 
876
- * Remove default `X-Download-Options` header
230
+ *Juan Vásquez*
877
231
 
878
- This header is currently only used by Internet Explorer which
879
- will be discontinued in 2022 and since Rails 7 does not fully
880
- support Internet Explorer this header should not be a default one.
232
+ * Add internal page `/rails/info/notes`, that displays the same information as `bin/rails notes`.
881
233
 
882
- *Harun Sabljaković*
234
+ *Deepak Mahakale*
883
235
 
884
- * Add .node-version files for Rails apps that use Node.js
236
+ * Add Rubocop and GitHub Actions to plugin generator.
237
+ This can be skipped using --skip-rubocop and --skip-ci.
885
238
 
886
- Node version managers that make use of this file:
887
- https://github.com/shadowspawn/node-version-usage#node-version-file-usage
239
+ *Chris Oliver*
888
240
 
889
- The generated Dockerfile will use the same node version.
241
+ * Use Kamal for deployment by default, which includes generating a Rails-specific config/deploy.yml.
242
+ This can be skipped using --skip-kamal. See more: https://kamal-deploy.org/
890
243
 
891
- *Sam Ruby*
244
+ *DHH*
892
245
 
893
- Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/railties/CHANGELOG.md) for previous changes.
246
+ Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/railties/CHANGELOG.md) for previous changes.