railties 7.0.10 → 7.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +565 -234
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.md +99 -0
- data/README.rdoc +4 -4
- data/lib/minitest/rails_plugin.rb +63 -0
- data/lib/rails/api/task.rb +35 -4
- data/lib/rails/app_updater.rb +1 -1
- data/lib/rails/application/bootstrap.rb +12 -3
- data/lib/rails/application/configuration.rb +179 -67
- data/lib/rails/application/default_middleware_stack.rb +8 -2
- data/lib/rails/application/dummy_config.rb +19 -0
- data/lib/rails/application/finisher.rb +40 -33
- data/lib/rails/application.rb +116 -31
- data/lib/rails/backtrace_cleaner.rb +1 -1
- data/lib/rails/cli.rb +5 -2
- data/lib/rails/command/actions.rb +10 -12
- data/lib/rails/command/base.rb +55 -53
- data/lib/rails/command/environment_argument.rb +32 -16
- data/lib/rails/command/helpers/editor.rb +17 -12
- data/lib/rails/command.rb +84 -33
- data/lib/rails/commands/about/about_command.rb +14 -0
- data/lib/rails/commands/application/application_command.rb +2 -0
- data/lib/rails/commands/console/console_command.rb +14 -14
- data/lib/rails/commands/credentials/USAGE +53 -55
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +5 -3
- data/lib/rails/commands/credentials/credentials_command.rb +64 -70
- data/lib/rails/commands/db/system/change/change_command.rb +2 -1
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +25 -115
- data/lib/rails/commands/destroy/destroy_command.rb +3 -2
- data/lib/rails/commands/dev/dev_command.rb +1 -6
- data/lib/rails/commands/encrypted/USAGE +15 -20
- data/lib/rails/commands/encrypted/encrypted_command.rb +46 -35
- data/lib/rails/commands/gem_help/USAGE +16 -0
- data/lib/rails/commands/gem_help/gem_help_command.rb +13 -0
- data/lib/rails/commands/generate/generate_command.rb +2 -2
- data/lib/rails/commands/help/USAGE +13 -13
- data/lib/rails/commands/help/help_command.rb +21 -2
- data/lib/rails/commands/initializers/initializers_command.rb +1 -4
- data/lib/rails/commands/middleware/middleware_command.rb +17 -0
- data/lib/rails/commands/new/new_command.rb +2 -0
- data/lib/rails/commands/notes/notes_command.rb +2 -1
- data/lib/rails/commands/plugin/plugin_command.rb +2 -0
- data/lib/rails/commands/rake/rake_command.rb +25 -22
- data/lib/rails/commands/restart/restart_command.rb +14 -0
- data/lib/rails/commands/routes/routes_command.rb +13 -1
- data/lib/rails/commands/runner/USAGE +14 -12
- data/lib/rails/commands/runner/runner_command.rb +32 -20
- data/lib/rails/commands/secret/secret_command.rb +13 -0
- data/lib/rails/commands/secrets/USAGE +44 -49
- data/lib/rails/commands/secrets/secrets_command.rb +19 -38
- data/lib/rails/commands/server/server_command.rb +32 -31
- data/lib/rails/commands/test/USAGE +14 -0
- data/lib/rails/commands/test/test_command.rb +56 -14
- data/lib/rails/commands/unused_routes/unused_routes_command.rb +75 -0
- data/lib/rails/commands/version/version_command.rb +1 -0
- data/lib/rails/configuration.rb +5 -5
- data/lib/rails/console/app.rb +1 -4
- data/lib/rails/deprecator.rb +7 -0
- data/lib/rails/engine/configuration.rb +5 -0
- data/lib/rails/engine.rb +36 -16
- data/lib/rails/gem_version.rb +4 -4
- data/lib/rails/generators/actions.rb +6 -15
- data/lib/rails/generators/active_model.rb +14 -28
- data/lib/rails/generators/app_base.rb +353 -82
- data/lib/rails/generators/app_name.rb +3 -14
- data/lib/rails/generators/base.rb +17 -9
- data/lib/rails/generators/database.rb +19 -1
- data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
- data/lib/rails/generators/generated_attribute.rb +2 -1
- data/lib/rails/generators/migration.rb +1 -2
- data/lib/rails/generators/model_helpers.rb +2 -1
- data/lib/rails/generators/rails/app/USAGE +15 -6
- data/lib/rails/generators/rails/app/app_generator.rb +84 -60
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +107 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +9 -11
- data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +10 -1
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +4 -17
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +0 -2
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +59 -0
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +10 -2
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +28 -24
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +11 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +2 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +223 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -9
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +11 -13
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +10 -19
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +4 -0
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +6 -4
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +10 -0
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +43 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +1 -9
- data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
- data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +10 -8
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +9 -7
- data/lib/rails/generators/rails/application_record/application_record_generator.rb +4 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +2 -1
- data/lib/rails/generators/rails/controller/USAGE +12 -4
- data/lib/rails/generators/rails/controller/controller_generator.rb +5 -0
- data/lib/rails/generators/rails/controller/templates/controller.rb.tt +1 -1
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +29 -24
- data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +8 -0
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -2
- data/lib/rails/generators/rails/migration/USAGE +21 -11
- data/lib/rails/generators/rails/model/model_generator.rb +4 -0
- data/lib/rails/generators/rails/plugin/USAGE +17 -6
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +5 -15
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -17
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -2
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +4 -4
- data/lib/rails/generators/rails/resource/resource_generator.rb +6 -0
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -1
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +1 -1
- data/lib/rails/generators/test_case.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +1 -1
- data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +4 -1
- data/lib/rails/generators.rb +6 -14
- data/lib/rails/health_controller.rb +55 -0
- data/lib/rails/info.rb +1 -1
- data/lib/rails/info_controller.rb +31 -11
- data/lib/rails/mailers_controller.rb +15 -5
- data/lib/rails/rack/logger.rb +15 -12
- data/lib/rails/rackup/server.rb +15 -0
- data/lib/rails/railtie/configuration.rb +14 -1
- data/lib/rails/railtie.rb +18 -18
- data/lib/rails/ruby_version_check.rb +2 -0
- data/lib/rails/source_annotation_extractor.rb +67 -18
- data/lib/rails/tasks/engine.rake +8 -8
- data/lib/rails/tasks/framework.rake +4 -10
- data/lib/rails/tasks/log.rake +1 -1
- data/lib/rails/tasks/misc.rake +3 -14
- data/lib/rails/tasks/statistics.rake +5 -4
- data/lib/rails/tasks/tmp.rake +5 -5
- data/lib/rails/tasks/zeitwerk.rake +1 -1
- data/lib/rails/tasks.rb +0 -2
- data/lib/rails/templates/rails/mailers/email.html.erb +25 -0
- data/lib/rails/templates/rails/mailers/index.html.erb +14 -7
- data/lib/rails/templates/rails/mailers/mailer.html.erb +11 -5
- data/lib/rails/templates/rails/welcome/index.html.erb +1 -0
- data/lib/rails/test_help.rb +7 -7
- data/lib/rails/test_unit/line_filtering.rb +1 -1
- data/lib/rails/test_unit/reporter.rb +6 -2
- data/lib/rails/test_unit/runner.rb +36 -18
- data/lib/rails/test_unit/test_parser.rb +88 -0
- data/lib/rails/test_unit/testing.rake +13 -33
- data/lib/rails/version.rb +1 -1
- data/lib/rails.rb +15 -15
- metadata +69 -31
- data/RDOC_MAIN.rdoc +0 -97
- data/lib/rails/application/dummy_erb_compiler.rb +0 -18
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +0 -143
- data/lib/rails/generators/rails/model/USAGE +0 -113
- data/lib/rails/tasks/middleware.rake +0 -9
- data/lib/rails/tasks/restart.rake +0 -9
data/CHANGELOG.md
CHANGED
|
@@ -1,453 +1,784 @@
|
|
|
1
|
-
## Rails 7.0.
|
|
1
|
+
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* `rails new --javascript` generator now supports Bun
|
|
4
4
|
|
|
5
|
+
```bash
|
|
6
|
+
rails new my_new_app --javascript=bun
|
|
7
|
+
```
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
*Jason Meller*
|
|
7
10
|
|
|
8
|
-
*
|
|
11
|
+
* bin/setup uses `bun` instead of `yarn` when generated an app with bun
|
|
9
12
|
|
|
13
|
+
Use `bun install` on `bin/setup` when using `bun`.
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
*Cadu Ribeiro*
|
|
12
16
|
|
|
13
|
-
*
|
|
17
|
+
* `config/application.rb` now includes
|
|
14
18
|
|
|
19
|
+
```ruby
|
|
20
|
+
config.autoload_lib(ignore: %w(assets tasks))
|
|
21
|
+
```
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
In practice, this means that new 7.1 applications autoload from `lib` out of the box.
|
|
17
24
|
|
|
18
|
-
*
|
|
25
|
+
*Xavier Noria*
|
|
19
26
|
|
|
27
|
+
* Add an option to start rails console in sandbox mode by default
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
`sandbox_by_default` option is added to start rails console in sandbox
|
|
30
|
+
mode by default. With this option turned on, `--no-sandbox` must be
|
|
31
|
+
specified to start rails in non-sandbox mode.
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
Note that this option is ignored when rails environment is development
|
|
34
|
+
or test.
|
|
24
35
|
|
|
36
|
+
*Shouichi Kamiya*
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
* Omit `webdrivers` gem dependency from `Gemfile` template
|
|
27
39
|
|
|
28
|
-
*
|
|
40
|
+
*Sean Doyle*
|
|
29
41
|
|
|
42
|
+
* Support filtering tests by line ranges
|
|
30
43
|
|
|
31
|
-
|
|
44
|
+
The new syntax allows you to filter tests by line ranges. For example, the
|
|
45
|
+
following command runs tests from line 10 to 20.
|
|
32
46
|
|
|
33
|
-
|
|
47
|
+
```bash
|
|
48
|
+
$ rails test test/models/user_test.rb:10-20
|
|
49
|
+
```
|
|
34
50
|
|
|
51
|
+
*Shouichi Kamiya*, *Seonggi Yang*, *oljfte*, *Ryohei UEDA*
|
|
35
52
|
|
|
36
|
-
|
|
53
|
+
* Update default scaffold templates to set 303 (See Other) as status code
|
|
54
|
+
on redirect for the update action for XHR requests other than GET or POST
|
|
55
|
+
to avoid issues (e.g browsers trying to follow the redirect using the
|
|
56
|
+
original request method resulting in double PATCH/PUT)
|
|
37
57
|
|
|
38
|
-
*
|
|
58
|
+
*Guillermo Iguaran*
|
|
39
59
|
|
|
60
|
+
* The new `config.autoload_lib_once` is similar to `config.autoload_lib`,
|
|
61
|
+
except that it adds `lib` to `config.autoload_once_paths` instead.
|
|
40
62
|
|
|
41
|
-
|
|
63
|
+
By calling `config.autoload_lib_once`, classes and modules in `lib` can be
|
|
64
|
+
autoloaded, even from application initializers, but won't be reloaded.
|
|
42
65
|
|
|
43
|
-
|
|
66
|
+
Please, see further details in the [autoloading
|
|
67
|
+
guide](https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html).
|
|
44
68
|
|
|
69
|
+
*Xavier Noria*
|
|
45
70
|
|
|
46
|
-
|
|
71
|
+
* Add `config.action_dispatch.debug_exception_log_level` to configure the log
|
|
72
|
+
level used by `ActionDispatch::DebugExceptions`.
|
|
47
73
|
|
|
48
|
-
|
|
74
|
+
The default is `:fatal`, but with `load_defaults "7.1"` the default will be
|
|
75
|
+
`:error`.
|
|
49
76
|
|
|
50
|
-
*
|
|
77
|
+
*Hartley McGuire*
|
|
51
78
|
|
|
52
|
-
|
|
79
|
+
* Add `DATABASE` option to `railties:install:migrations`
|
|
53
80
|
|
|
54
|
-
|
|
81
|
+
This allows you to specify which database the migrations should be copied to
|
|
82
|
+
when running `rails railties:install:migrations`.
|
|
55
83
|
|
|
84
|
+
```bash
|
|
85
|
+
$ rails railties:install:migrations DATABASE=animals
|
|
86
|
+
```
|
|
56
87
|
|
|
57
|
-
|
|
88
|
+
*Matthew Hirst*
|
|
58
89
|
|
|
59
|
-
*
|
|
90
|
+
* The new method `config.autoload_lib(ignore:)` provides a simple way to
|
|
91
|
+
autoload from `lib`:
|
|
60
92
|
|
|
93
|
+
```ruby
|
|
94
|
+
# config/application.rb
|
|
95
|
+
config.autoload_lib(ignore: %w(assets tasks))
|
|
96
|
+
```
|
|
61
97
|
|
|
62
|
-
|
|
98
|
+
Please, see further details in the [autoloading
|
|
99
|
+
guide](https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html).
|
|
63
100
|
|
|
64
|
-
*
|
|
65
|
-
on redirect for the update action for XHR requests other than GET or POST
|
|
66
|
-
to avoid issues (e.g browsers trying to follow the redirect using the
|
|
67
|
-
original request method resulting in double PATCH/PUT)
|
|
101
|
+
*Xavier Noria*
|
|
68
102
|
|
|
69
|
-
|
|
103
|
+
* Don't show secret_key_base for `Rails.application.config#inspect`.
|
|
70
104
|
|
|
105
|
+
Before:
|
|
71
106
|
|
|
72
|
-
|
|
73
|
-
|
|
107
|
+
```ruby
|
|
108
|
+
Rails.application.config.inspect
|
|
109
|
+
"#<Rails::Application::Configuration:0x00000001132b02a0 @root=... @secret_key_base=\"b3c631c314c0bbca50c1b2843150fe33\" ... >"
|
|
110
|
+
```
|
|
74
111
|
|
|
75
|
-
|
|
112
|
+
After:
|
|
76
113
|
|
|
114
|
+
```ruby
|
|
115
|
+
Rails.application.config.inspect
|
|
116
|
+
"#<Rails::Application::Configuration:0x00000001132b02a0>"
|
|
117
|
+
```
|
|
77
118
|
|
|
78
|
-
|
|
119
|
+
*Petrik de Heus*
|
|
79
120
|
|
|
80
|
-
*
|
|
121
|
+
* Deprecate calling `Rails.application.secrets`.
|
|
81
122
|
|
|
123
|
+
Rails `secrets` have been deprecated in favor of `credentials`.
|
|
124
|
+
Calling `Rails.application.secrets` should show a deprecation warning.
|
|
82
125
|
|
|
83
|
-
|
|
126
|
+
*Petrik de Heus*
|
|
84
127
|
|
|
85
|
-
*
|
|
128
|
+
* Store `secret_key_base` in `Rails.config` for local environments.
|
|
86
129
|
|
|
87
|
-
|
|
130
|
+
Rails `secrets` have been deprecated in favor of `credentials`.
|
|
131
|
+
For the local environments the `secret_key_base` is now stored in
|
|
132
|
+
`Rails.config.secret_key_base` instead of the soft deprecated
|
|
133
|
+
`Rails.application.secrets.secret_key_base`.
|
|
88
134
|
|
|
89
|
-
*
|
|
135
|
+
*Petrik de Heus*
|
|
90
136
|
|
|
91
|
-
|
|
137
|
+
* Enable force_ssl=true in production by default: Force all access to the app over SSL,
|
|
138
|
+
use Strict-Transport-Security, and use secure cookies
|
|
92
139
|
|
|
93
|
-
*
|
|
140
|
+
*Justin Searls*, *Aaron Patterson*, *Guillermo Iguaran*, *Vinícius Bispo*
|
|
94
141
|
|
|
95
|
-
*
|
|
96
|
-
|
|
142
|
+
* Add engine's draw paths to application route set, so that the application
|
|
143
|
+
can draw route files defined in engine paths.
|
|
97
144
|
|
|
98
|
-
*
|
|
145
|
+
*Gannon McGibbon*
|
|
99
146
|
|
|
147
|
+
* Support `VISUAL` environment variable for commands which open an editor,
|
|
148
|
+
and prefer it over `EDITOR`.
|
|
100
149
|
|
|
101
|
-
|
|
150
|
+
*Summer ☀️*
|
|
102
151
|
|
|
103
|
-
*
|
|
152
|
+
* Add engine's `test/fixtures` path to `fixture_paths` in `on_load` hook if
|
|
153
|
+
path exists and is under the Rails application root.
|
|
104
154
|
|
|
155
|
+
*Chris Salzberg*
|
|
105
156
|
|
|
106
|
-
|
|
157
|
+
* `bin/rails app:template` now runs `bundle install` and any `after_bundle`
|
|
158
|
+
blocks after the template is executed.
|
|
107
159
|
|
|
108
|
-
*
|
|
160
|
+
*Jonathan Hefner* and *Gerry Caulfield*
|
|
109
161
|
|
|
162
|
+
* Enable passing column size to migration generator
|
|
110
163
|
|
|
111
|
-
|
|
164
|
+
Previously you could pass a limit to the migration generator:
|
|
112
165
|
|
|
113
|
-
|
|
166
|
+
`rails generate migration CreateAuthor name:text{65535}`
|
|
114
167
|
|
|
168
|
+
Now, a size attribute can be passed to the migration generator:
|
|
115
169
|
|
|
116
|
-
|
|
170
|
+
`rails generate migration CreateAuthor name:text{medium}`
|
|
117
171
|
|
|
118
|
-
|
|
172
|
+
This generates a migration which includes the size attribute:
|
|
119
173
|
|
|
120
|
-
|
|
121
|
-
|
|
174
|
+
```ruby
|
|
175
|
+
class CreateAuthor < ActiveRecord::Migration[7.1]
|
|
176
|
+
def change
|
|
177
|
+
create_table :authors do |t|
|
|
178
|
+
t.text :name, size: :medium
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
```
|
|
122
183
|
|
|
123
|
-
*
|
|
184
|
+
*Josh Broughton*, *Hartley McGuire*
|
|
124
185
|
|
|
125
|
-
*
|
|
186
|
+
* Trying to set a config key with the same name of a method now raises:
|
|
126
187
|
|
|
127
|
-
|
|
188
|
+
```ruby
|
|
189
|
+
config.load_defaults = 7.0
|
|
190
|
+
# NoMethodError: Cannot assign to `load_defaults`, it is a configuration method
|
|
191
|
+
```
|
|
128
192
|
|
|
129
|
-
*
|
|
193
|
+
*Xavier Noria*
|
|
130
194
|
|
|
131
|
-
|
|
195
|
+
* Deprecate `secrets:edit/show` and remove `secrets:setup`
|
|
132
196
|
|
|
133
|
-
|
|
197
|
+
`bin/rails secrets:setup` has been deprecated since Rails 5.2 in favor of
|
|
198
|
+
credentials. This command has been removed.
|
|
134
199
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
the `application.rb` file.
|
|
200
|
+
`bin/rails secrets:show` and `bin/rails secrets:edit` have been deprecated
|
|
201
|
+
in favor of credentials.
|
|
138
202
|
|
|
139
|
-
|
|
203
|
+
Run `bin/rails credentials:help` for more information
|
|
140
204
|
|
|
205
|
+
*Petrik de Heus*
|
|
141
206
|
|
|
142
|
-
|
|
207
|
+
* `bin/rails --help` will now list only framework and plugin commands. Rake
|
|
208
|
+
tasks defined in `lib/tasks/*.rake` files will no longer be included. For a
|
|
209
|
+
list of those tasks, use `rake -T`.
|
|
143
210
|
|
|
144
|
-
*
|
|
211
|
+
*Jonathan Hefner*
|
|
145
212
|
|
|
213
|
+
* Allow calling `bin/rails restart` outside of app directory.
|
|
146
214
|
|
|
147
|
-
|
|
215
|
+
The following would previously fail with a "No Rakefile found" error.
|
|
148
216
|
|
|
149
|
-
|
|
217
|
+
```bash
|
|
218
|
+
$ blog/bin/rails restart
|
|
219
|
+
```
|
|
150
220
|
|
|
151
|
-
*
|
|
221
|
+
*Petrik de Heus*
|
|
152
222
|
|
|
153
|
-
*
|
|
223
|
+
* Support prerelease rubies in Gemfile template if RubyGems version is 3.3.13 or higher.
|
|
154
224
|
|
|
155
|
-
|
|
156
|
-
a namespaced controller with a top-level model using `--model-name`.
|
|
225
|
+
*Yasuo Honda*, *David Rodríguez*
|
|
157
226
|
|
|
158
|
-
|
|
227
|
+
* Autoloading setup honors root directories manually set by the user.
|
|
228
|
+
|
|
229
|
+
This is relevant for custom namespaces. For example, if you'd like classes
|
|
230
|
+
and modules under `app/services` to be defined in the `Services` namespace
|
|
231
|
+
without an extra `app/services/services` directory, this is now enough:
|
|
232
|
+
|
|
233
|
+
```ruby
|
|
234
|
+
# config/initializers/autoloading.rb
|
|
235
|
+
|
|
236
|
+
# The namespace has to exist.
|
|
237
|
+
#
|
|
238
|
+
# In this example we define the module on the spot. Could also be created
|
|
239
|
+
# elsewhere and its definition loaded here with an ordinary `require`. In
|
|
240
|
+
# any case, `push_dir` expects a class or module object.
|
|
241
|
+
module Services; end
|
|
159
242
|
|
|
160
|
-
|
|
161
|
-
bin/rails generate scaffold_controller Admin/Post --model-name Post
|
|
243
|
+
Rails.autoloaders.main.push_dir("#{Rails.root}/app/services", namespace: Services)
|
|
162
244
|
```
|
|
163
245
|
|
|
164
|
-
|
|
246
|
+
Check the autoloading guide for further details.
|
|
165
247
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
248
|
+
*Xavier Noria*
|
|
249
|
+
|
|
250
|
+
* Railties now requires the irb gem as a dependency, which means when you install Rails, irb will also
|
|
251
|
+
be installed as a gem. Rails will then use the installed version of irb for its console instead of
|
|
252
|
+
relying on Ruby's built-in version.
|
|
253
|
+
This ensures that Rails has access to the most up-to-date and reliable version of irb for its console.
|
|
254
|
+
|
|
255
|
+
*Stan Lo*
|
|
256
|
+
|
|
257
|
+
* Use infinitive form for all rails command descriptions verbs.
|
|
258
|
+
|
|
259
|
+
*Petrik de Heus*
|
|
260
|
+
|
|
261
|
+
* Credentials commands (e.g. `bin/rails credentials:edit`) now respect
|
|
262
|
+
`config.credentials.content_path` and `config.credentials.key_path` when set
|
|
263
|
+
in `config/application.rb` or `config/environments/#{Rails.env}.rb`.
|
|
264
|
+
|
|
265
|
+
Before:
|
|
266
|
+
|
|
267
|
+
* `bin/rails credentials:edit` ignored `RAILS_ENV`, and would always edit
|
|
268
|
+
`config/credentials.yml.enc`.
|
|
269
|
+
|
|
270
|
+
* `bin/rails credentials:edit --environment foo` would create and edit
|
|
271
|
+
`config/credentials/foo.yml.enc`.
|
|
272
|
+
|
|
273
|
+
* If `config.credentials.content_path` or `config.credentials.key_path`
|
|
274
|
+
was set, `bin/rails credentials:edit` could not be used to edit the
|
|
275
|
+
credentials. Editing credentials required using `bin/rails
|
|
276
|
+
encrypted:edit path/to/credentials --key path/to/key`.
|
|
277
|
+
|
|
278
|
+
After:
|
|
279
|
+
|
|
280
|
+
* `bin/rails credentials:edit` will edit the credentials file that the app
|
|
281
|
+
would load for the current `RAILS_ENV`.
|
|
282
|
+
|
|
283
|
+
* `bin/rails credentials:edit` respects `config.credentials.content_path`
|
|
284
|
+
and `config.credentials.key_path` when set in `config/application.rb`
|
|
285
|
+
or `config/environments/#{Rails.env}.rb`.
|
|
286
|
+
|
|
287
|
+
* `bin/rails credentials:edit --environment foo` will create and edit
|
|
288
|
+
`config/credentials/foo.yml.enc` _if_ `config.credentials.content_path`
|
|
289
|
+
has not been set for the `foo` environment. Ultimately, it will edit
|
|
290
|
+
the credentials file that the app would load for the `foo` environment.
|
|
291
|
+
|
|
292
|
+
*Jonathan Hefner*
|
|
293
|
+
|
|
294
|
+
* Add descriptions for non-Rake commands when running `rails -h`.
|
|
295
|
+
|
|
296
|
+
*Petrik de Heus*
|
|
297
|
+
|
|
298
|
+
* Show relevant commands when calling help
|
|
299
|
+
|
|
300
|
+
When running `rails -h` or just `rails` outside a Rails application,
|
|
301
|
+
Rails outputs all options for running the `rails new` command. This can be
|
|
302
|
+
confusing to users when they probably want to see the common Rails commands.
|
|
303
|
+
|
|
304
|
+
Instead, we should always show the common commands when running `rails -h`
|
|
305
|
+
inside or outside a Rails application.
|
|
306
|
+
|
|
307
|
+
As the relevant commands inside a Rails application differ from the
|
|
308
|
+
commands outside an application, the help USAGE file has been split to
|
|
309
|
+
show the most relevant commands for the context.
|
|
310
|
+
|
|
311
|
+
*Petrik de Heus*
|
|
312
|
+
|
|
313
|
+
* Add Rails::HealthController#show and map it to /up for newly generated applications.
|
|
314
|
+
Load balancers and uptime monitors all need a basic endpoint to tell whether the app is up.
|
|
315
|
+
This is a good starting point that'll work in many situations.
|
|
316
|
+
|
|
317
|
+
*DHH*
|
|
318
|
+
|
|
319
|
+
* Only use HostAuthorization middleware if `config.hosts` is not empty
|
|
320
|
+
|
|
321
|
+
*Hartley McGuire*
|
|
322
|
+
|
|
323
|
+
* Raise an exception when a `before_action`'s "only" or "except" filter
|
|
324
|
+
options reference an action that doesn't exist. This will be enabled by
|
|
325
|
+
default but can be overridden via config.
|
|
326
|
+
|
|
327
|
+
```ruby
|
|
328
|
+
# config/environments/production.rb
|
|
329
|
+
config.action_controller.raise_on_missing_callback_actions = false
|
|
171
330
|
```
|
|
172
331
|
|
|
173
|
-
|
|
332
|
+
*Jess Bees*
|
|
174
333
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
334
|
+
* Use physical processor count as the default Puma worker count in production.
|
|
335
|
+
This can be overridden by setting `ENV["WEB_CONCURRENCY"]` or editing the
|
|
336
|
+
generated "config/puma.rb" directly.
|
|
337
|
+
|
|
338
|
+
*DHH*
|
|
339
|
+
|
|
340
|
+
* Add Docker files by default to new apps: Dockerfile, .dockerignore, bin/docker-entrypoint.
|
|
341
|
+
These files can be skipped with `--skip-docker`. They're intended as a starting point for
|
|
342
|
+
a production deploy of the application. Not intended for development (see Docked Rails for that).
|
|
343
|
+
|
|
344
|
+
Example:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
$ docker build -t app .
|
|
348
|
+
$ docker volume create app-storage
|
|
349
|
+
$ docker run --rm -it -v app-storage:/rails/storage -p 3000:3000 --env RAILS_MASTER_KEY=<see config/master.key> app
|
|
180
350
|
```
|
|
181
351
|
|
|
182
|
-
|
|
352
|
+
You can also start a console or a runner from this image:
|
|
183
353
|
|
|
184
|
-
|
|
354
|
+
```bash
|
|
355
|
+
$ docker run --rm -it -v app-storage:/rails/storage --env RAILS_MASTER_KEY=<see config/master.key> app console
|
|
356
|
+
```
|
|
185
357
|
|
|
186
|
-
|
|
358
|
+
To create a multi-platform image on Apple Silicon to deploy on AMD or Intel and push to Docker Hub for user/app:
|
|
187
359
|
|
|
188
|
-
|
|
360
|
+
```bash
|
|
361
|
+
$ docker login -u <user>
|
|
362
|
+
$ docker buildx create --use
|
|
363
|
+
$ docker buildx build --push --platform=linux/amd64,linux/arm64 -t <user/image> .
|
|
364
|
+
```
|
|
189
365
|
|
|
366
|
+
*DHH, Sam Ruby*
|
|
190
367
|
|
|
191
|
-
|
|
368
|
+
* Add ENV["SECRET_KEY_BASE_DUMMY"] for starting production environment with a generated secret base key,
|
|
369
|
+
which can be used to run tasks like `assets:precompile` without making the RAILS_MASTER_KEY available
|
|
370
|
+
to the build process.
|
|
192
371
|
|
|
193
|
-
|
|
372
|
+
Dockerfile layer example:
|
|
194
373
|
|
|
374
|
+
```
|
|
375
|
+
RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile
|
|
376
|
+
```
|
|
195
377
|
|
|
196
|
-
|
|
378
|
+
*DHH*
|
|
197
379
|
|
|
198
|
-
*
|
|
380
|
+
* Show descriptions for all commands in Rails help
|
|
199
381
|
|
|
382
|
+
When calling `rails help` most commands missed their description. We now
|
|
383
|
+
show the same descriptions as shown in `rails -T`.
|
|
200
384
|
|
|
201
|
-
|
|
385
|
+
*Petrik de Heus*
|
|
202
386
|
|
|
203
|
-
*
|
|
387
|
+
* Always generate the storage/ directory with rails new to ensure there's a stable place to
|
|
388
|
+
put permanent files, and a single mount point for containers to map. Then default sqlite3 databases
|
|
389
|
+
to live there instead of db/, which is only meant for configuration, not data.
|
|
204
390
|
|
|
391
|
+
*DHH*
|
|
205
392
|
|
|
206
|
-
|
|
393
|
+
* Rails console now disables `IRB`'s autocompletion feature in production by default.
|
|
207
394
|
|
|
208
|
-
|
|
395
|
+
Setting `IRB_USE_AUTOCOMPLETE=true` can override this default.
|
|
209
396
|
|
|
397
|
+
*Stan Lo*
|
|
210
398
|
|
|
211
|
-
|
|
399
|
+
* Add `config.precompile_filter_parameters`, which enables precompilation of
|
|
400
|
+
`config.filter_parameters` using `ActiveSupport::ParameterFilter.precompile_filters`.
|
|
401
|
+
Precompilation can improve filtering performance, depending on the quantity
|
|
402
|
+
and types of filters.
|
|
212
403
|
|
|
213
|
-
|
|
404
|
+
`config.precompile_filter_parameters` defaults to `true` for
|
|
405
|
+
`config.load_defaults 7.1` and above.
|
|
214
406
|
|
|
215
407
|
*Jonathan Hefner*
|
|
216
408
|
|
|
217
|
-
*
|
|
409
|
+
* Add `after_routes_loaded` hook to `Rails::Railtie::Configuration` for
|
|
410
|
+
engines to add a hook to be called after application routes have been
|
|
411
|
+
loaded.
|
|
412
|
+
|
|
413
|
+
```ruby
|
|
414
|
+
MyEngine.config.after_routes_loaded do
|
|
415
|
+
# code that must happen after routes have been loaded
|
|
416
|
+
end
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
*Chris Salzberg*
|
|
420
|
+
|
|
421
|
+
* Send 303 See Other status code back for the destroy action on newly generated
|
|
422
|
+
scaffold controllers.
|
|
423
|
+
|
|
424
|
+
*Tony Drake*
|
|
425
|
+
|
|
426
|
+
* Add `Rails.application.deprecators` as a central point to manage deprecators
|
|
427
|
+
for an application.
|
|
428
|
+
|
|
429
|
+
Individual deprecators can be added and retrieved from the collection:
|
|
430
|
+
|
|
431
|
+
```ruby
|
|
432
|
+
Rails.application.deprecators[:my_gem] = ActiveSupport::Deprecation.new("2.0", "MyGem")
|
|
433
|
+
Rails.application.deprecators[:other_gem] = ActiveSupport::Deprecation.new("3.0", "OtherGem")
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
And the collection's configuration methods affect all deprecators in the
|
|
437
|
+
collection:
|
|
438
|
+
|
|
439
|
+
```ruby
|
|
440
|
+
Rails.application.deprecators.debug = true
|
|
441
|
+
|
|
442
|
+
Rails.application.deprecators[:my_gem].debug
|
|
443
|
+
# => true
|
|
444
|
+
Rails.application.deprecators[:other_gem].debug
|
|
445
|
+
# => true
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Additionally, all deprecators in the collection can be silenced for the
|
|
449
|
+
duration of a given block:
|
|
450
|
+
|
|
451
|
+
```ruby
|
|
452
|
+
Rails.application.deprecators.silence do
|
|
453
|
+
Rails.application.deprecators[:my_gem].warn # => silenced (no warning)
|
|
454
|
+
Rails.application.deprecators[:other_gem].warn # => silenced (no warning)
|
|
455
|
+
end
|
|
456
|
+
```
|
|
218
457
|
|
|
219
458
|
*Jonathan Hefner*
|
|
220
459
|
|
|
221
|
-
*
|
|
460
|
+
* Move dbconsole logic to Active Record connection adapter.
|
|
461
|
+
|
|
462
|
+
Instead of hosting the connection logic in the command object, the
|
|
463
|
+
database adapter should be responsible for connecting to a console session.
|
|
464
|
+
This patch moves #find_cmd_and_exec to the adapter and exposes a new API to
|
|
465
|
+
lookup the adapter class without instantiating it.
|
|
466
|
+
|
|
467
|
+
*Gannon McGibbon*, *Paarth Madan*
|
|
468
|
+
|
|
469
|
+
* Add `Rails.application.message_verifiers` as a central point to configure
|
|
470
|
+
and create message verifiers for an application.
|
|
471
|
+
|
|
472
|
+
This allows applications to, for example, rotate old `secret_key_base`
|
|
473
|
+
values:
|
|
474
|
+
|
|
475
|
+
```ruby
|
|
476
|
+
config.before_initialize do |app|
|
|
477
|
+
app.message_verifiers.rotate(secret_key_base: "old secret_key_base")
|
|
478
|
+
end
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
And for libraries to create preconfigured message verifiers:
|
|
482
|
+
|
|
483
|
+
```ruby
|
|
484
|
+
ActiveStorage.verifier = Rails.application.message_verifiers["ActiveStorage"]
|
|
485
|
+
```
|
|
222
486
|
|
|
223
487
|
*Jonathan Hefner*
|
|
224
488
|
|
|
225
|
-
*
|
|
226
|
-
namespaces.
|
|
489
|
+
* Support MySQL's ssl-mode option for the dbconsole command.
|
|
227
490
|
|
|
228
|
-
|
|
229
|
-
|
|
491
|
+
Verifying the identity of the database server requires setting the ssl-mode
|
|
492
|
+
option to VERIFY_CA or VERIFY_IDENTITY. This option was previously ignored
|
|
493
|
+
for the dbconsole command.
|
|
230
494
|
|
|
231
|
-
*
|
|
495
|
+
*Petrik de Heus*
|
|
496
|
+
|
|
497
|
+
* Delegate application record generator description to orm hooked generator.
|
|
232
498
|
|
|
233
|
-
*
|
|
499
|
+
*Gannon McGibbon*
|
|
234
500
|
|
|
235
|
-
|
|
501
|
+
* Show BCC recipients when present in Action Mailer previews.
|
|
236
502
|
|
|
503
|
+
*Akshay Birajdar*
|
|
237
504
|
|
|
238
|
-
|
|
505
|
+
* Extend `routes --grep` to also filter routes by matching against path.
|
|
239
506
|
|
|
240
|
-
|
|
507
|
+
Example:
|
|
241
508
|
|
|
509
|
+
```bash
|
|
510
|
+
$ bin/rails routes --grep /cats/1
|
|
511
|
+
Prefix Verb URI Pattern Controller#Action
|
|
512
|
+
cat GET /cats/:id(.:format) cats#show
|
|
513
|
+
PATCH /cats/:id(.:format) cats#update
|
|
514
|
+
PUT /cats/:id(.:format) cats#update
|
|
515
|
+
DELETE /cats/:id(.:format) cats#destroy
|
|
516
|
+
```
|
|
242
517
|
|
|
243
|
-
|
|
518
|
+
*Orhan Toy*
|
|
244
519
|
|
|
245
|
-
*
|
|
520
|
+
* Improve `rails runner` output when given a file path that doesn't exist.
|
|
246
521
|
|
|
247
|
-
|
|
522
|
+
*Tekin Suleyman*
|
|
248
523
|
|
|
249
|
-
|
|
524
|
+
* `config.allow_concurrency = false` now use a `Monitor` instead of a `Mutex`
|
|
250
525
|
|
|
251
|
-
|
|
526
|
+
This allows to enable `config.active_support.executor_around_test_case` even
|
|
527
|
+
when `config.allow_concurrency` is disabled.
|
|
528
|
+
|
|
529
|
+
*Jean Boussier*
|
|
252
530
|
|
|
253
|
-
|
|
531
|
+
* Add `routes --unused` option to detect extraneous routes.
|
|
254
532
|
|
|
255
|
-
|
|
533
|
+
Example:
|
|
256
534
|
|
|
257
|
-
|
|
535
|
+
```bash
|
|
536
|
+
$ bin/rails routes --unused
|
|
258
537
|
|
|
259
|
-
|
|
538
|
+
Found 2 unused routes:
|
|
260
539
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
540
|
+
Prefix Verb URI Pattern Controller#Action
|
|
541
|
+
one GET /one(.:format) action#one
|
|
542
|
+
two GET /two(.:format) action#two
|
|
543
|
+
```
|
|
265
544
|
|
|
266
|
-
|
|
267
|
-
suggests setting this header to '0' to disable the default behaviour
|
|
268
|
-
on old browsers as it can introduce additional security issues.
|
|
545
|
+
*Gannon McGibbon*
|
|
269
546
|
|
|
270
|
-
|
|
547
|
+
* Add `--parent` option to controller generator to specify parent class of job.
|
|
271
548
|
|
|
272
|
-
|
|
549
|
+
Example:
|
|
273
550
|
|
|
274
|
-
|
|
275
|
-
date_select, time_select and datetime_select; thus providing native date/time pickers.
|
|
551
|
+
`bin/rails g controller admin/users --parent=admin_controller` generates:
|
|
276
552
|
|
|
277
|
-
|
|
553
|
+
```ruby
|
|
554
|
+
class Admin::UsersController < AdminController
|
|
555
|
+
# ...
|
|
556
|
+
end
|
|
557
|
+
```
|
|
278
558
|
|
|
279
|
-
*
|
|
559
|
+
*Gannon McGibbon*
|
|
280
560
|
|
|
281
|
-
|
|
561
|
+
* In-app custom credentials templates are now supported. When a credentials
|
|
562
|
+
file does not exist, `rails credentials:edit` will now try to use
|
|
563
|
+
`lib/templates/rails/credentials/credentials.yml.tt` to generate the
|
|
564
|
+
credentials file, before falling back to the default template.
|
|
282
565
|
|
|
283
|
-
|
|
566
|
+
This allows e.g. an open-source Rails app (which would not include encrypted
|
|
567
|
+
credentials files in its repo) to include a credentials template, so that
|
|
568
|
+
users who install the app will get a custom pre-filled credentials file when
|
|
569
|
+
they run `rails credentials:edit`.
|
|
284
570
|
|
|
285
|
-
*
|
|
571
|
+
*Jonathan Hefner*
|
|
286
572
|
|
|
287
|
-
|
|
573
|
+
* Except for `dev` and `test` environments, newly generated per-environment
|
|
574
|
+
credentials files (e.g. `config/credentials/production.yml.enc`) now include
|
|
575
|
+
a `secret_key_base` for convenience, just as `config/credentials.yml.enc`
|
|
576
|
+
does.
|
|
288
577
|
|
|
289
|
-
|
|
578
|
+
*Jonathan Hefner*
|
|
290
579
|
|
|
291
|
-
*
|
|
292
|
-
|
|
580
|
+
* `--no-*` options now work with the app generator's `--minimal` option, and
|
|
581
|
+
are both comprehensive and precise. For example:
|
|
582
|
+
|
|
583
|
+
```bash
|
|
584
|
+
$ rails new my_cool_app --minimal
|
|
585
|
+
Based on the specified options, the following options will also be activated:
|
|
586
|
+
|
|
587
|
+
--skip-active-job [due to --minimal]
|
|
588
|
+
--skip-action-mailer [due to --skip-active-job, --minimal]
|
|
589
|
+
--skip-active-storage [due to --skip-active-job, --minimal]
|
|
590
|
+
--skip-action-mailbox [due to --skip-active-storage, --minimal]
|
|
591
|
+
--skip-action-text [due to --skip-active-storage, --minimal]
|
|
592
|
+
--skip-javascript [due to --minimal]
|
|
593
|
+
--skip-hotwire [due to --skip-javascript, --minimal]
|
|
594
|
+
--skip-action-cable [due to --minimal]
|
|
595
|
+
--skip-bootsnap [due to --minimal]
|
|
596
|
+
--skip-dev-gems [due to --minimal]
|
|
597
|
+
--skip-system-test [due to --minimal]
|
|
598
|
+
|
|
599
|
+
...
|
|
600
|
+
|
|
601
|
+
$ rails new my_cool_app --minimal --no-skip-active-storage
|
|
602
|
+
Based on the specified options, the following options will also be activated:
|
|
603
|
+
|
|
604
|
+
--skip-action-mailer [due to --minimal]
|
|
605
|
+
--skip-action-mailbox [due to --minimal]
|
|
606
|
+
--skip-action-text [due to --minimal]
|
|
607
|
+
--skip-javascript [due to --minimal]
|
|
608
|
+
--skip-hotwire [due to --skip-javascript, --minimal]
|
|
609
|
+
--skip-action-cable [due to --minimal]
|
|
610
|
+
--skip-bootsnap [due to --minimal]
|
|
611
|
+
--skip-dev-gems [due to --minimal]
|
|
612
|
+
--skip-system-test [due to --minimal]
|
|
613
|
+
|
|
614
|
+
...
|
|
615
|
+
```
|
|
293
616
|
|
|
294
|
-
|
|
295
|
-
The new framework defaults file can be used to upgrade the serializer.
|
|
617
|
+
*Brad Trick* and *Jonathan Hefner*
|
|
296
618
|
|
|
297
|
-
|
|
619
|
+
* Add `--skip-dev-gems` option to app generator to skip adding development
|
|
620
|
+
gems (like `web-console`) to the Gemfile.
|
|
298
621
|
|
|
299
|
-
*
|
|
622
|
+
*Brad Trick*
|
|
300
623
|
|
|
301
|
-
|
|
624
|
+
* Skip Active Storage and Action Mailer if Active Job is skipped.
|
|
302
625
|
|
|
303
|
-
|
|
626
|
+
*Étienne Barrié*
|
|
304
627
|
|
|
305
|
-
|
|
628
|
+
* Correctly check if frameworks are disabled when running app:update.
|
|
306
629
|
|
|
307
|
-
*
|
|
630
|
+
*Étienne Barrié* and *Paulo Barros*
|
|
308
631
|
|
|
309
|
-
*
|
|
632
|
+
* Delegate model generator description to orm hooked generator.
|
|
310
633
|
|
|
311
|
-
*
|
|
634
|
+
*Gannon McGibbon*
|
|
312
635
|
|
|
313
|
-
*
|
|
314
|
-
available autoloading mode.
|
|
636
|
+
* Execute `rails runner` scripts inside the executor.
|
|
315
637
|
|
|
316
|
-
|
|
638
|
+
Enables error reporting, query cache, etc.
|
|
317
639
|
|
|
318
|
-
*
|
|
319
|
-
application class defined in `config/application.rb` or in the configuration
|
|
320
|
-
for environments in `config/environments/*`.
|
|
640
|
+
*Jean Boussier*
|
|
321
641
|
|
|
322
|
-
|
|
323
|
-
engine class or in the configuration for environments.
|
|
642
|
+
* Avoid booting in development then test for test tasks.
|
|
324
643
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
644
|
+
Running one of the rails test subtasks (e.g. test:system, test:models) would
|
|
645
|
+
go through Rake and cause the app to be booted twice. Now all the test:*
|
|
646
|
+
subtasks are defined as Thor tasks and directly load the test environment.
|
|
328
647
|
|
|
329
|
-
|
|
648
|
+
*Étienne Barrié*
|
|
330
649
|
|
|
331
|
-
*
|
|
332
|
-
like application models, unless they are wrapped in a `to_prepare` block.
|
|
333
|
-
For example, from `config/initializers/*`, or in application, engines, or
|
|
334
|
-
railties initializers.
|
|
650
|
+
* Deprecate `Rails::Generators::Testing::Behaviour` in favor of `Rails::Generators::Testing::Behavior`.
|
|
335
651
|
|
|
336
|
-
|
|
337
|
-
guide](https://guides.rubyonrails.org/v7.0/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots)
|
|
338
|
-
for details.
|
|
652
|
+
*Gannon McGibbon*
|
|
339
653
|
|
|
340
|
-
|
|
654
|
+
* Allow configuration of logger size for local and test environments
|
|
341
655
|
|
|
342
|
-
|
|
343
|
-
that `config.autoload_once_paths` is a subset of `config.autoload_paths`.
|
|
344
|
-
The former are managed by the `once` autoloader. The `main` autoloader
|
|
345
|
-
manages the latter minus the former.
|
|
656
|
+
`config.log_file_size`
|
|
346
657
|
|
|
347
|
-
|
|
658
|
+
Defaults to `100` megabytes.
|
|
348
659
|
|
|
349
|
-
*
|
|
660
|
+
*Bernie Chiu*
|
|
350
661
|
|
|
351
|
-
|
|
352
|
-
|
|
662
|
+
* Enroll new apps in decrypted diffs of credentials by default. This behavior
|
|
663
|
+
can be opted out of with the app generator's `--skip-decrypted-diffs` flag.
|
|
353
664
|
|
|
354
|
-
*
|
|
665
|
+
*Jonathan Hefner*
|
|
355
666
|
|
|
356
|
-
*
|
|
667
|
+
* Support declarative-style test name filters with `bin/rails test`.
|
|
357
668
|
|
|
358
|
-
|
|
669
|
+
This makes it possible to run a declarative-style test such as:
|
|
359
670
|
|
|
360
|
-
|
|
671
|
+
```ruby
|
|
672
|
+
class MyTest < ActiveSupport::TestCase
|
|
673
|
+
test "does something" do
|
|
674
|
+
# ...
|
|
675
|
+
end
|
|
676
|
+
end
|
|
677
|
+
```
|
|
361
678
|
|
|
362
|
-
|
|
679
|
+
Using its declared name:
|
|
363
680
|
|
|
364
|
-
|
|
681
|
+
```bash
|
|
682
|
+
$ bin/rails test test/my_test.rb -n "does something"
|
|
683
|
+
```
|
|
365
684
|
|
|
366
|
-
|
|
685
|
+
Instead of having to specify its expanded method name:
|
|
367
686
|
|
|
368
|
-
|
|
687
|
+
```bash
|
|
688
|
+
$ bin/rails test test/my_test.rb -n test_does_something
|
|
689
|
+
```
|
|
369
690
|
|
|
370
|
-
*
|
|
691
|
+
*Jonathan Hefner*
|
|
371
692
|
|
|
372
|
-
*
|
|
373
|
-
`rails g scaffold Author` no longer generates tests called "creating
|
|
374
|
-
a Author", "updating a Author", and "destroying a Author".
|
|
693
|
+
* Add `--js` and `--skip-javascript` options to `rails new`
|
|
375
694
|
|
|
376
|
-
|
|
695
|
+
`--js` alias to `rails new --javascript ...`
|
|
377
696
|
|
|
378
|
-
|
|
697
|
+
Same as `-j`, e.g. `rails new --js esbuild ...`
|
|
379
698
|
|
|
380
|
-
|
|
699
|
+
`--skip-js` alias to `rails new --skip-javascript ...`
|
|
381
700
|
|
|
382
|
-
|
|
701
|
+
Same as `-J`, e.g. `rails new --skip-js ...`
|
|
383
702
|
|
|
384
|
-
*
|
|
703
|
+
*Dorian Marié*
|
|
385
704
|
|
|
386
|
-
|
|
705
|
+
* Allow relative paths with leading dot slash to be passed to `rails test`.
|
|
387
706
|
|
|
388
|
-
|
|
707
|
+
Fix `rails test ./test/model/post_test.rb` to run a single test file.
|
|
389
708
|
|
|
390
|
-
|
|
391
|
-
`Rails.application.config_for` now uses `YAML.unsafe_load` if available.
|
|
709
|
+
*Shouichi Kamiya* and *oljfte*
|
|
392
710
|
|
|
393
|
-
|
|
711
|
+
* 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.
|
|
394
712
|
|
|
395
|
-
*
|
|
713
|
+
*Xavier Noria*
|
|
396
714
|
|
|
397
|
-
|
|
715
|
+
* 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.
|
|
398
716
|
|
|
399
|
-
*
|
|
717
|
+
*Xavier Noria*
|
|
400
718
|
|
|
401
|
-
|
|
719
|
+
* Add JavaScript dependencies installation on bin/setup
|
|
402
720
|
|
|
403
|
-
|
|
404
|
-
referencing it in middleware operations without adding it back.
|
|
721
|
+
Add `yarn install` to bin/setup when using esbuild, webpack, or rollout.
|
|
405
722
|
|
|
406
|
-
*
|
|
723
|
+
*Carlos Ribeiro*
|
|
407
724
|
|
|
408
|
-
*
|
|
725
|
+
* Use `controller_class_path` in `Rails::Generators::NamedBase#route_url`
|
|
409
726
|
|
|
410
|
-
|
|
727
|
+
The `route_url` method now returns the correct path when generating
|
|
728
|
+
a namespaced controller with a top-level model using `--model-name`.
|
|
411
729
|
|
|
412
|
-
|
|
730
|
+
Previously, when running this command:
|
|
413
731
|
|
|
414
|
-
|
|
732
|
+
```bash
|
|
733
|
+
$ bin/rails generate scaffold_controller Admin/Post --model-name Post
|
|
734
|
+
```
|
|
415
735
|
|
|
416
|
-
|
|
736
|
+
the comments above the controller action would look like:
|
|
417
737
|
|
|
418
|
-
|
|
738
|
+
``` ruby
|
|
739
|
+
# GET /posts
|
|
740
|
+
def index
|
|
741
|
+
@posts = Post.all
|
|
742
|
+
end
|
|
743
|
+
```
|
|
419
744
|
|
|
420
|
-
|
|
421
|
-
course of developing a Rails app. See [#41083](https://github.com/rails/rails/pull/41083) for
|
|
422
|
-
the full list of changes.
|
|
745
|
+
afterwards, they now look like this:
|
|
423
746
|
|
|
424
|
-
|
|
747
|
+
``` ruby
|
|
748
|
+
# GET /admin/posts
|
|
749
|
+
def index
|
|
750
|
+
@posts = Post.all
|
|
751
|
+
end
|
|
752
|
+
```
|
|
425
753
|
|
|
426
|
-
|
|
754
|
+
Fixes #44662.
|
|
427
755
|
|
|
428
|
-
*
|
|
756
|
+
*Andrew White*
|
|
429
757
|
|
|
430
|
-
*
|
|
758
|
+
* No longer add autoloaded paths to `$LOAD_PATH`.
|
|
431
759
|
|
|
432
|
-
|
|
433
|
-
Rails.benchmark("test_expensive_stuff") { ... }
|
|
434
|
-
end
|
|
760
|
+
This means it won't be possible to load them with a manual `require` call, the class or module can be referenced instead.
|
|
435
761
|
|
|
436
|
-
|
|
762
|
+
Reducing the size of `$LOAD_PATH` speed-up `require` calls for apps not using `bootsnap`, and reduce the
|
|
763
|
+
size of the `bootsnap` cache for the others.
|
|
437
764
|
|
|
438
|
-
*
|
|
765
|
+
*Jean Boussier*
|
|
439
766
|
|
|
440
|
-
*
|
|
767
|
+
* Remove default `X-Download-Options` header
|
|
441
768
|
|
|
442
|
-
|
|
769
|
+
This header is currently only used by Internet Explorer which
|
|
770
|
+
will be discontinued in 2022 and since Rails 7 does not fully
|
|
771
|
+
support Internet Explorer this header should not be a default one.
|
|
443
772
|
|
|
444
|
-
*
|
|
773
|
+
*Harun Sabljaković*
|
|
445
774
|
|
|
446
|
-
|
|
775
|
+
* Add .node-version files for Rails apps that use Node.js
|
|
447
776
|
|
|
448
|
-
|
|
777
|
+
Node version managers that make use of this file:
|
|
778
|
+
https://github.com/shadowspawn/node-version-usage#node-version-file-usage
|
|
449
779
|
|
|
450
|
-
|
|
780
|
+
The generated Dockerfile will use the same node version.
|
|
451
781
|
|
|
782
|
+
*Sam Ruby*
|
|
452
783
|
|
|
453
|
-
Please check [
|
|
784
|
+
Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/railties/CHANGELOG.md) for previous changes.
|