railties 8.0.3 → 8.1.0
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 +101 -206
- data/lib/minitest/rails_plugin.rb +48 -12
- data/lib/rails/application/bootstrap.rb +5 -0
- data/lib/rails/application/configuration.rb +31 -9
- data/lib/rails/application/default_middleware_stack.rb +1 -1
- data/lib/rails/application/finisher.rb +2 -1
- data/lib/rails/application/routes_reloader.rb +0 -1
- data/lib/rails/application.rb +1 -3
- data/lib/rails/code_statistics.rb +4 -1
- data/lib/rails/command/base.rb +0 -2
- data/lib/rails/command/environment_argument.rb +0 -1
- data/lib/rails/command.rb +1 -1
- data/lib/rails/commands/app/update_command.rb +1 -0
- data/lib/rails/commands/console/irb_console.rb +4 -4
- data/lib/rails/commands/credentials/credentials_command.rb +25 -5
- data/lib/rails/commands/encrypted/encrypted_command.rb +0 -1
- data/lib/rails/engine.rb +0 -1
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators/actions.rb +2 -3
- data/lib/rails/generators/app_base.rb +49 -28
- data/lib/rails/generators/database.rb +1 -1
- data/lib/rails/generators/erb/authentication/authentication_generator.rb +2 -0
- data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +2 -2
- data/lib/rails/generators/generated_attribute.rb +1 -1
- data/lib/rails/generators/migration.rb +0 -1
- data/lib/rails/generators/rails/app/app_generator.rb +16 -5
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +19 -15
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +6 -1
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +5 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -0
- data/lib/rails/generators/rails/app/templates/bin/bundler-audit.tt +5 -0
- data/lib/rails/generators/rails/app/templates/bin/ci.tt +5 -0
- data/lib/rails/generators/rails/app/templates/bin/rubocop.tt +1 -1
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +1 -0
- data/lib/rails/generators/rails/app/templates/config/bundler-audit.yml.tt +5 -0
- data/lib/rails/generators/rails/app/templates/config/ci.rb.tt +38 -0
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +9 -1
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +10 -2
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +9 -1
- data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +21 -16
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +8 -0
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +4 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_1.rb.tt +74 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +3 -2
- data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +0 -7
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +0 -6
- data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +107 -21
- data/lib/rails/generators/rails/app/templates/github/dependabot.yml +2 -2
- data/lib/rails/generators/rails/app/templates/kamal-secrets.tt +4 -1
- data/lib/rails/generators/rails/app/templates/public/400.html +26 -5
- data/lib/rails/generators/rails/app/templates/public/404.html +27 -6
- data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +25 -4
- data/lib/rails/generators/rails/app/templates/public/422.html +26 -5
- data/lib/rails/generators/rails/app/templates/public/500.html +27 -6
- data/lib/rails/generators/rails/authentication/authentication_generator.rb +8 -6
- data/lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt +6 -0
- data/lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt +2 -2
- data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt +3 -1
- data/lib/rails/generators/rails/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt +3 -1
- data/lib/rails/generators/rails/benchmark/USAGE +1 -1
- data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +0 -2
- data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +1 -1
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +4 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt +2 -2
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +1 -1
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +17 -5
- data/lib/rails/generators/rails/master_key/master_key_generator.rb +0 -12
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +1 -0
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +0 -4
- data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +20 -9
- data/lib/rails/generators/rails/plugin/templates/github/dependabot.yml +2 -2
- data/lib/rails/generators/rails/script/USAGE +1 -1
- data/lib/rails/generators/test_unit/authentication/authentication_generator.rb +13 -0
- data/lib/rails/generators/test_unit/authentication/templates/test/controllers/passwords_controller_test.rb.tt +67 -0
- data/lib/rails/generators/test_unit/authentication/templates/test/controllers/sessions_controller_test.rb +33 -0
- data/lib/rails/generators/test_unit/authentication/templates/test/models/user_test.rb.tt +4 -3
- data/lib/rails/generators/test_unit/authentication/templates/test/test_helpers/session_test_helper.rb.tt +19 -0
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +1 -1
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +4 -2
- data/lib/rails/generators/testing/behavior.rb +0 -3
- data/lib/rails/generators.rb +3 -1
- data/lib/rails/health_controller.rb +8 -2
- data/lib/rails/info.rb +4 -5
- data/lib/rails/info_controller.rb +4 -5
- data/lib/rails/initializable.rb +63 -19
- data/lib/rails/rack/silence_request.rb +5 -2
- data/lib/rails/railtie/configurable.rb +0 -1
- data/lib/rails/railtie.rb +0 -1
- data/lib/rails/tasks/statistics.rake +3 -21
- data/lib/rails/tasks.rb +1 -3
- data/lib/rails/templates/rails/info/notes.html.erb +23 -0
- data/lib/rails/templates/rails/mailers/email.html.erb +2 -1
- data/lib/rails/templates/rails/welcome/index.html.erb +19 -3
- data/lib/rails/test_unit/reporter.rb +5 -4
- data/lib/rails/test_unit/runner.rb +8 -5
- data/lib/rails.rb +9 -2
- metadata +18 -15
- data/lib/rails/console/methods.rb +0 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +0 -30
- data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +0 -15
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +0 -7
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad8da0555d797f82b2d0201539e2b87d71a4a034693160ce5f1a695bb2fba206
|
|
4
|
+
data.tar.gz: 7141209b64c173556b4e68710077f2020a0e4d1f78849f189b618ae5aadf0323
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb16ac913da82747b4d06e8c7578ccc830219010f1ef5846305f2f6640a84f08df45f191f76899b6449d7dd85903a7e89f236b33cb8c83daef7f46863f86cf6f
|
|
7
|
+
data.tar.gz: badbe8ab05d917deed317baf5d1b8adbb339c95ed6bd0ea01f13c6d61ff41d270e49b27624d0d27f94625bb26466f141506638b44c6e2936b5b99d281f748fb5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,289 +1,184 @@
|
|
|
1
|
-
## Rails 8.0
|
|
1
|
+
## Rails 8.1.0 (October 22, 2025) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
3
|
+
* Suggest `bin/rails action_text:install` from Action Dispatch error page
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Fix Rails console to not override user defined IRB_NAME.
|
|
8
|
-
|
|
9
|
-
Only change the prompt name if it hasn't been customized in `.irbrc`.
|
|
10
|
-
|
|
11
|
-
*Jarrett Lusso*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Rails 8.0.2.1 (August 13, 2025) ##
|
|
15
|
-
|
|
16
|
-
* No changes.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Rails 8.0.2 (March 12, 2025) ##
|
|
20
|
-
|
|
21
|
-
* Fix Rails console to load routes.
|
|
22
|
-
|
|
23
|
-
Otherwise `*_path` and `*url` methods are missing on the `app` object.
|
|
24
|
-
|
|
25
|
-
*Édouard Chin*
|
|
26
|
-
|
|
27
|
-
* Update `rails new --minimal` option
|
|
28
|
-
|
|
29
|
-
Extend the `--minimal` flag to exclude recently added features:
|
|
30
|
-
`skip_brakeman`, `skip_ci`, `skip_docker`, `skip_kamal`, `skip_rubocop`, `skip_solid` and `skip_thruster`.
|
|
31
|
-
|
|
32
|
-
*eelcoj*
|
|
33
|
-
|
|
34
|
-
* Use `secret_key_base` from ENV or credentials when present locally.
|
|
35
|
-
|
|
36
|
-
When ENV["SECRET_KEY_BASE"] or
|
|
37
|
-
`Rails.application.credentials.secret_key_base` is set for test or
|
|
38
|
-
development, it is used for the `Rails.config.secret_key_base`,
|
|
39
|
-
instead of generating a `tmp/local_secret.txt` file.
|
|
40
|
-
|
|
41
|
-
*Petrik de Heus*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## Rails 8.0.1 (December 13, 2024) ##
|
|
45
|
-
|
|
46
|
-
* Skip generation system tests related code for CI when `--skip-system-test` is given.
|
|
47
|
-
|
|
48
|
-
*fatkodima*
|
|
49
|
-
|
|
50
|
-
* Don't add bin/thrust if thruster is not in Gemfile.
|
|
51
|
-
|
|
52
|
-
*Étienne Barrié*
|
|
53
|
-
|
|
54
|
-
* Don't install a package for system test when applications don't use it.
|
|
55
|
-
|
|
56
|
-
*y-yagi*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Rails 8.0.0.1 (December 10, 2024) ##
|
|
60
|
-
|
|
61
|
-
* No changes.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
## Rails 8.0.0 (November 07, 2024) ##
|
|
65
|
-
|
|
66
|
-
* No changes.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
|
70
|
-
|
|
71
|
-
* Fix incorrect database.yml with `skip_solid`.
|
|
72
|
-
|
|
73
|
-
*Joé Dupuis*
|
|
5
|
+
*Sean Doyle*
|
|
74
6
|
|
|
75
|
-
*
|
|
7
|
+
* Remove deprecated `STATS_DIRECTORIES`.
|
|
76
8
|
|
|
77
9
|
*Rafael Mendonça França*
|
|
78
10
|
|
|
79
|
-
|
|
80
|
-
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
|
81
|
-
|
|
82
|
-
* Remove deprecated support to extend Rails console through `Rails::ConsoleMethods`.
|
|
11
|
+
* Remove deprecated `bin/rake stats` command.
|
|
83
12
|
|
|
84
13
|
*Rafael Mendonça França*
|
|
85
14
|
|
|
86
|
-
* Remove deprecated
|
|
15
|
+
* Remove deprecated `rails/console/methods.rb` file.
|
|
87
16
|
|
|
88
17
|
*Rafael Mendonça França*
|
|
89
18
|
|
|
90
|
-
*
|
|
19
|
+
* Don't generate system tests by default.
|
|
91
20
|
|
|
92
|
-
|
|
21
|
+
Rails scaffold generator will no longer generate system tests by default. To enable this pass `--system-tests=true` or generate them with `bin/rails generate system_test name_of_test`.
|
|
93
22
|
|
|
94
|
-
*
|
|
23
|
+
*Eileen M. Uchitelle*
|
|
95
24
|
|
|
96
|
-
|
|
25
|
+
* Optionally skip bundler-audit.
|
|
26
|
+
|
|
27
|
+
Skips adding the `bin/bundler-audit` & `config/bundler-audit.yml` if the gem is not installed when `bin/rails app:update` runs.
|
|
97
28
|
|
|
98
|
-
|
|
29
|
+
Passes an option to `--skip-bundler-audit` when new apps are generated & adds that same option to the `--minimal` generator flag.
|
|
99
30
|
|
|
100
|
-
|
|
31
|
+
*Jill Klang*
|
|
101
32
|
|
|
102
|
-
|
|
33
|
+
* Show engine routes in `/rails/info/routes` as well.
|
|
103
34
|
|
|
35
|
+
*Petrik de Heus*
|
|
104
36
|
|
|
105
|
-
|
|
37
|
+
* Exclude `asset_path` configuration from Kamal `deploy.yml` for API applications.
|
|
106
38
|
|
|
107
|
-
|
|
39
|
+
API applications don't serve assets, so the `asset_path` configuration in `deploy.yml`
|
|
40
|
+
is not needed and can cause 404 errors on in-flight requests. The asset_path is now
|
|
41
|
+
only included for regular Rails applications that serve assets.
|
|
108
42
|
|
|
109
|
-
|
|
43
|
+
*Saiqul Haq*
|
|
110
44
|
|
|
111
|
-
|
|
45
|
+
* Reverted the incorrect default `config.public_file_server.headers` config.
|
|
112
46
|
|
|
113
|
-
|
|
47
|
+
If you created a new application using Rails `8.1.0.beta1`, make sure to regenerate
|
|
48
|
+
`config/environments/production.rb`, or to manually edit the `config.public_file_server.headers`
|
|
49
|
+
configuration to just be:
|
|
114
50
|
|
|
115
|
-
|
|
51
|
+
```ruby
|
|
52
|
+
# Cache assets for far-future expiry since they are all digest stamped.
|
|
53
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
|
|
54
|
+
```
|
|
116
55
|
|
|
117
|
-
*
|
|
56
|
+
*Jean Boussier*
|
|
118
57
|
|
|
119
|
-
*
|
|
58
|
+
* Add command `rails credentials:fetch PATH` to get the value of a credential from the credentials file.
|
|
120
59
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
60
|
+
```bash
|
|
61
|
+
$ bin/rails credentials:fetch kamal_registry.password
|
|
62
|
+
```
|
|
124
63
|
|
|
125
|
-
|
|
126
|
-
are in use.
|
|
64
|
+
*Matthew Nguyen*, *Jean Boussier*
|
|
127
65
|
|
|
128
|
-
|
|
66
|
+
* Generate static BCrypt password digests in fixtures instead of dynamic ERB expressions.
|
|
129
67
|
|
|
130
|
-
|
|
68
|
+
Previously, fixtures with password digest attributes used `<%= BCrypt::Password.create("secret") %>`,
|
|
69
|
+
which regenerated the hash on each test run. Now generates a static hash with a comment
|
|
70
|
+
showing how to recreate it.
|
|
131
71
|
|
|
132
|
-
*
|
|
72
|
+
*Nate Smith*, *Cassia Scheffer*
|
|
133
73
|
|
|
134
|
-
*
|
|
74
|
+
* Broaden the `.gitignore` entry when adding a credentials key to ignore all key files.
|
|
135
75
|
|
|
136
|
-
*
|
|
76
|
+
*Greg Molnar*
|
|
137
77
|
|
|
138
|
-
*
|
|
78
|
+
* Remove unnecessary `ruby-version` input from `ruby/setup-ruby`
|
|
139
79
|
|
|
140
|
-
*
|
|
80
|
+
*TangRufus*
|
|
141
81
|
|
|
142
|
-
* Add
|
|
143
|
-
to silence requests to "/up". This prevents the Kamal-required health checks from clogging up
|
|
144
|
-
the production logs.
|
|
82
|
+
* Add --reset option to bin/setup which will call db:reset as part of the setup.
|
|
145
83
|
|
|
146
84
|
*DHH*
|
|
147
85
|
|
|
148
|
-
*
|
|
86
|
+
* Add RuboCop cache restoration to RuboCop job in GitHub Actions workflow templates.
|
|
149
87
|
|
|
150
|
-
|
|
151
|
-
Dev Container. The original `mysql` and `trilogy` options will use `mysql`. Users who are not
|
|
152
|
-
generating a Dev Container do not need to use the new options.
|
|
88
|
+
*Lovro Bikić*
|
|
153
89
|
|
|
154
|
-
|
|
90
|
+
* Skip generating mailer-related files in authentication generator if the application does
|
|
91
|
+
not use ActionMailer
|
|
155
92
|
|
|
156
|
-
*
|
|
93
|
+
*Rami Massoud*
|
|
157
94
|
|
|
158
|
-
|
|
159
|
-
`Rails::CodeStatistics.register_directory`.
|
|
95
|
+
* Introduce `bin/ci` for running your tests, style checks, and security audits locally or in the cloud.
|
|
160
96
|
|
|
161
|
-
|
|
97
|
+
The specific steps are defined by a new DSL in `config/ci.rb`.
|
|
162
98
|
|
|
163
99
|
```ruby
|
|
164
|
-
|
|
165
|
-
|
|
100
|
+
ActiveSupport::ContinuousIntegration.run do
|
|
101
|
+
step "Setup", "bin/setup --skip-server"
|
|
102
|
+
step "Style: Ruby", "bin/rubocop"
|
|
103
|
+
step "Security: Gem audit", "bin/bundler-audit"
|
|
104
|
+
step "Tests: Rails", "bin/rails test test:system"
|
|
105
|
+
end
|
|
166
106
|
```
|
|
167
107
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
* Enable query log tags by default on development env
|
|
171
|
-
|
|
172
|
-
This can be used to trace troublesome SQL statements back to the application
|
|
173
|
-
code that generated these statements. It is also useful when using multiple
|
|
174
|
-
databases because the query logs can identify which database is being used.
|
|
108
|
+
Optionally use [gh-signoff](https://github.com/basecamp/gh-signoff) to
|
|
109
|
+
set a green PR status - ready for merge.
|
|
175
110
|
|
|
176
|
-
*
|
|
111
|
+
*Jeremy Daer*, *DHH*
|
|
177
112
|
|
|
178
|
-
*
|
|
113
|
+
* Generate session controller tests when running the authentication generator.
|
|
179
114
|
|
|
180
|
-
|
|
181
|
-
url_helpers receives a route call / asked if it responds to a route.
|
|
182
|
-
Previously, this was executed unconditionally on boot, which can
|
|
183
|
-
slow down boot time unnecessarily for larger apps with lots of routes.
|
|
115
|
+
*Jerome Dalbert*
|
|
184
116
|
|
|
185
|
-
|
|
186
|
-
continue to eagerly load routes on boot.
|
|
117
|
+
* Add bin/bundler-audit and config/bundler-audit.yml for discovering and managing known security problems with app gems.
|
|
187
118
|
|
|
188
|
-
*
|
|
119
|
+
*DHH*
|
|
189
120
|
|
|
190
|
-
*
|
|
121
|
+
* Rails no longer generates a `bin/bundle` binstub when creating new applications.
|
|
191
122
|
|
|
192
|
-
|
|
123
|
+
The `bin/bundle` binstub used to help activate the right version of bundler.
|
|
124
|
+
This is no longer necessary as this mechanism is now part of Rubygem itself.
|
|
193
125
|
|
|
194
|
-
*
|
|
126
|
+
*Edouard Chin*
|
|
195
127
|
|
|
196
|
-
|
|
128
|
+
* Add a `SessionTestHelper` module with `sign_in_as(user)` and `sign_out` test helpers when
|
|
129
|
+
running `rails g authentication`. Simplifies authentication in integration tests.
|
|
197
130
|
|
|
198
|
-
|
|
199
|
-
bin/rails generate authentication
|
|
200
|
-
```
|
|
131
|
+
*Bijan Rahnema*
|
|
201
132
|
|
|
202
|
-
|
|
133
|
+
* Rate limit password resets in authentication generator
|
|
203
134
|
|
|
204
|
-
|
|
205
|
-
app/models/current.rb
|
|
206
|
-
app/models/user.rb
|
|
207
|
-
app/models/session.rb
|
|
208
|
-
app/controllers/sessions_controller.rb
|
|
209
|
-
app/controllers/passwords_controller.rb
|
|
210
|
-
app/mailers/passwords_mailer.rb
|
|
211
|
-
app/views/sessions/new.html.erb
|
|
212
|
-
app/views/passwords/new.html.erb
|
|
213
|
-
app/views/passwords/edit.html.erb
|
|
214
|
-
app/views/passwords_mailer/reset.html.erb
|
|
215
|
-
app/views/passwords_mailer/reset.text.erb
|
|
216
|
-
db/migrate/xxxxxxx_create_users.rb
|
|
217
|
-
db/migrate/xxxxxxx_create_sessions.rb
|
|
218
|
-
test/mailers/previews/passwords_mailer_preview.rb
|
|
219
|
-
```
|
|
135
|
+
This helps mitigate abuse from attackers spamming the password reset form.
|
|
220
136
|
|
|
221
|
-
*
|
|
137
|
+
*Chris Oliver*
|
|
222
138
|
|
|
139
|
+
* Update `rails new --minimal` option
|
|
223
140
|
|
|
224
|
-
|
|
141
|
+
Extend the `--minimal` flag to exclude recently added features:
|
|
142
|
+
`skip_brakeman`, `skip_ci`, `skip_docker`, `skip_kamal`, `skip_rubocop`, `skip_solid` and `skip_thruster`.
|
|
225
143
|
|
|
226
|
-
|
|
144
|
+
*eelcoj*
|
|
227
145
|
|
|
228
|
-
|
|
229
|
-
bin/rails generate migration CreateUsers email_address:string!:uniq password_digest:string!
|
|
230
|
-
```
|
|
146
|
+
* Add `application-name` metadata to application layout
|
|
231
147
|
|
|
232
|
-
|
|
148
|
+
The following metatag will be added to `app/views/layouts/application.html.erb`
|
|
233
149
|
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
def change
|
|
237
|
-
create_table :users do |t|
|
|
238
|
-
t.string :email_address, null: false
|
|
239
|
-
t.string :password_digest, null: false
|
|
240
|
-
|
|
241
|
-
t.timestamps
|
|
242
|
-
end
|
|
243
|
-
add_index :users, :email_address, unique: true
|
|
244
|
-
end
|
|
245
|
-
end
|
|
150
|
+
```html
|
|
151
|
+
<meta name="application-name" content="Name of Rails Application">
|
|
246
152
|
```
|
|
247
153
|
|
|
248
|
-
*
|
|
249
|
-
|
|
250
|
-
* Add a `script` folder to applications, and a scripts generator.
|
|
251
|
-
|
|
252
|
-
The new `script` folder is meant to hold one-off or general purpose scripts,
|
|
253
|
-
such as data migration scripts, cleanup scripts, etc.
|
|
154
|
+
*Steve Polito*
|
|
254
155
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
```
|
|
258
|
-
bin/rails generate script my_script
|
|
259
|
-
bin/rails generate script data/backfill
|
|
260
|
-
```
|
|
156
|
+
* Use `secret_key_base` from ENV or credentials when present locally.
|
|
261
157
|
|
|
262
|
-
|
|
158
|
+
When ENV["SECRET_KEY_BASE"] or
|
|
159
|
+
`Rails.application.credentials.secret_key_base` is set for test or
|
|
160
|
+
development, it is used for the `Rails.config.secret_key_base`,
|
|
161
|
+
instead of generating a `tmp/local_secret.txt` file.
|
|
263
162
|
|
|
264
|
-
|
|
265
|
-
bundle exec ruby script/my_script.rb
|
|
266
|
-
bundle exec ruby script/data/backfill.rb
|
|
267
|
-
```
|
|
163
|
+
*Petrik de Heus*
|
|
268
164
|
|
|
269
|
-
|
|
165
|
+
* Introduce `RAILS_MASTER_KEY` placeholder in generated ci.yml files
|
|
270
166
|
|
|
271
|
-
*
|
|
167
|
+
*Steve Polito*
|
|
272
168
|
|
|
273
|
-
|
|
169
|
+
* Colorize the Rails console prompt even on non standard environments.
|
|
274
170
|
|
|
275
|
-
*
|
|
171
|
+
*Lorenzo Zabot*
|
|
276
172
|
|
|
277
|
-
|
|
173
|
+
* Don't enable YJIT in development and test environments
|
|
278
174
|
|
|
279
|
-
|
|
280
|
-
|
|
175
|
+
Development and test environments tend to reload code and redefine methods (e.g. mocking),
|
|
176
|
+
hence YJIT isn't generally faster in these environments.
|
|
281
177
|
|
|
282
|
-
*
|
|
178
|
+
*Ali Ismayilov*, *Jean Boussier*
|
|
283
179
|
|
|
284
|
-
*
|
|
285
|
-
This can be skipped using --skip-kamal. See more: https://kamal-deploy.org/
|
|
180
|
+
* Only include PermissionsPolicy::Middleware if policy is configured.
|
|
286
181
|
|
|
287
|
-
*
|
|
182
|
+
*Petrik de Heus*
|
|
288
183
|
|
|
289
|
-
Please check [
|
|
184
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/railties/CHANGELOG.md) for previous changes.
|
|
@@ -26,6 +26,8 @@ module Minitest
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
class ProfileReporter < Reporter
|
|
29
|
+
attr_accessor :results
|
|
30
|
+
|
|
29
31
|
def initialize(io = $stdout, options = {})
|
|
30
32
|
super
|
|
31
33
|
@results = []
|
|
@@ -33,26 +35,49 @@ module Minitest
|
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
def record(result)
|
|
36
|
-
|
|
38
|
+
if output_file = ENV["RAILTIES_OUTPUT_FILE"]
|
|
39
|
+
File.open(output_file, "a") do |f|
|
|
40
|
+
# Round-trip for re-serialization
|
|
41
|
+
data = JSON.parse(result.to_json)
|
|
42
|
+
data[:location] = result.location
|
|
43
|
+
f.puts(data.to_json)
|
|
44
|
+
end
|
|
45
|
+
else
|
|
46
|
+
@results << result
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def passed?
|
|
51
|
+
true
|
|
37
52
|
end
|
|
38
53
|
|
|
39
54
|
def report
|
|
40
|
-
|
|
55
|
+
# Skip if we're outputting to a file
|
|
56
|
+
return if ENV["RAILTIES_OUTPUT_FILE"]
|
|
57
|
+
print_summary
|
|
58
|
+
end
|
|
41
59
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
def summary
|
|
61
|
+
print_summary
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private
|
|
65
|
+
def print_summary
|
|
66
|
+
total_time = @results.sum(&:time)
|
|
45
67
|
|
|
46
|
-
|
|
68
|
+
@results.sort! { |a, b| b.time <=> a.time }
|
|
69
|
+
slow_results = @results.take(@count)
|
|
70
|
+
slow_tests_total_time = slow_results.sum(&:time)
|
|
47
71
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
io.puts("
|
|
72
|
+
ratio = (total_time == 0) ? 0.0 : (slow_tests_total_time / total_time) * 100
|
|
73
|
+
|
|
74
|
+
io.puts("\nTop %d slowest tests (%.2f seconds, %.1f%% of total time):\n" % [slow_results.size, slow_tests_total_time, ratio])
|
|
75
|
+
slow_results.each do |result|
|
|
76
|
+
io.puts(" %s\n %.4f seconds %s\n" % [result.location, result.time, source_location(result)])
|
|
77
|
+
end
|
|
78
|
+
io.puts("\n")
|
|
51
79
|
end
|
|
52
|
-
io.puts("\n")
|
|
53
|
-
end
|
|
54
80
|
|
|
55
|
-
private
|
|
56
81
|
def source_location(result)
|
|
57
82
|
filename, line = result.source_location
|
|
58
83
|
return "" unless filename
|
|
@@ -102,8 +127,19 @@ module Minitest
|
|
|
102
127
|
options[:profile] = count
|
|
103
128
|
end
|
|
104
129
|
|
|
130
|
+
opts.on(/^[^-]/) do |test_file|
|
|
131
|
+
options[:test_files] ||= []
|
|
132
|
+
options[:test_files] << test_file
|
|
133
|
+
end
|
|
134
|
+
|
|
105
135
|
options[:color] = true
|
|
106
136
|
options[:output_inline] = true
|
|
137
|
+
|
|
138
|
+
opts.on do
|
|
139
|
+
if ::Rails::TestUnit::Runner.load_test_files
|
|
140
|
+
::Rails::TestUnit::Runner.load_tests(options.fetch(:test_files, []))
|
|
141
|
+
end
|
|
142
|
+
end
|
|
107
143
|
end
|
|
108
144
|
|
|
109
145
|
# Owes great inspiration to test runner trailblazers like RSpec,
|
|
@@ -71,6 +71,11 @@ module Rails
|
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
+
initializer :initialize_event_reporter, group: :all do
|
|
75
|
+
Rails.event.raise_on_error = config.consider_all_requests_local
|
|
76
|
+
Rails.event.debug_mode = Rails.env.development?
|
|
77
|
+
end
|
|
78
|
+
|
|
74
79
|
# Initialize cache early in the stack so railties can make use of it.
|
|
75
80
|
initializer :initialize_cache, group: :all do
|
|
76
81
|
cache_format_version = config.active_support.delete(:cache_format_version)
|
|
@@ -21,6 +21,7 @@ module Rails
|
|
|
21
21
|
:beginning_of_week, :filter_redirect, :x,
|
|
22
22
|
:content_security_policy_report_only,
|
|
23
23
|
:content_security_policy_nonce_generator, :content_security_policy_nonce_directives,
|
|
24
|
+
:content_security_policy_nonce_auto,
|
|
24
25
|
:require_master_key, :credentials, :disable_sandbox, :sandbox_by_default,
|
|
25
26
|
:add_autoload_paths_to_load_path, :rake_eager_load, :server_timing, :log_file_size,
|
|
26
27
|
:dom_testing_default_html_version, :yjit
|
|
@@ -72,6 +73,7 @@ module Rails
|
|
|
72
73
|
@content_security_policy_report_only = false
|
|
73
74
|
@content_security_policy_nonce_generator = nil
|
|
74
75
|
@content_security_policy_nonce_directives = nil
|
|
76
|
+
@content_security_policy_nonce_auto = false
|
|
75
77
|
@require_master_key = false
|
|
76
78
|
@loaded_config_version = nil
|
|
77
79
|
@credentials = ActiveSupport::InheritableOptions.new(credentials_defaults)
|
|
@@ -115,10 +117,6 @@ module Rails
|
|
|
115
117
|
action_controller.forgery_protection_origin_check = true
|
|
116
118
|
end
|
|
117
119
|
|
|
118
|
-
if respond_to?(:active_support)
|
|
119
|
-
active_support.to_time_preserves_timezone = :offset
|
|
120
|
-
end
|
|
121
|
-
|
|
122
120
|
if respond_to?(:active_record)
|
|
123
121
|
active_record.belongs_to_required_by_default = true
|
|
124
122
|
end
|
|
@@ -265,7 +263,7 @@ module Rails
|
|
|
265
263
|
end
|
|
266
264
|
|
|
267
265
|
if respond_to?(:action_controller)
|
|
268
|
-
action_controller.
|
|
266
|
+
action_controller.action_on_open_redirect = :raise
|
|
269
267
|
action_controller.wrap_parameters_by_default = true
|
|
270
268
|
end
|
|
271
269
|
when "7.1"
|
|
@@ -337,15 +335,39 @@ module Rails
|
|
|
337
335
|
when "8.0"
|
|
338
336
|
load_defaults "7.2"
|
|
339
337
|
|
|
340
|
-
if respond_to?(:active_support)
|
|
341
|
-
active_support.to_time_preserves_timezone = :zone
|
|
342
|
-
end
|
|
343
|
-
|
|
344
338
|
if respond_to?(:action_dispatch)
|
|
345
339
|
action_dispatch.strict_freshness = true
|
|
346
340
|
end
|
|
347
341
|
|
|
348
342
|
Regexp.timeout ||= 1 if Regexp.respond_to?(:timeout=)
|
|
343
|
+
when "8.1"
|
|
344
|
+
load_defaults "8.0"
|
|
345
|
+
|
|
346
|
+
# Development and test environments tend to reload code and
|
|
347
|
+
# redefine methods (e.g. mocking), hence YJIT isn't generally
|
|
348
|
+
# faster in these environments.
|
|
349
|
+
self.yjit = !Rails.env.local?
|
|
350
|
+
|
|
351
|
+
if respond_to?(:action_controller)
|
|
352
|
+
action_controller.escape_json_responses = false
|
|
353
|
+
action_controller.action_on_path_relative_redirect = :raise
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
if respond_to?(:active_record)
|
|
357
|
+
active_record.raise_on_missing_required_finder_order_columns = true
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
if respond_to?(:active_support)
|
|
361
|
+
active_support.escape_js_separators_in_json = false
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
if respond_to?(:action_view)
|
|
365
|
+
action_view.render_tracker = :ruby
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
if respond_to?(:action_view)
|
|
369
|
+
action_view.remove_hidden_field_autocomplete = true
|
|
370
|
+
end
|
|
349
371
|
else
|
|
350
372
|
raise "Unknown version #{target_version.to_s.inspect}"
|
|
351
373
|
end
|
|
@@ -83,7 +83,7 @@ module Rails
|
|
|
83
83
|
unless config.api_only
|
|
84
84
|
middleware.use ::ActionDispatch::Flash
|
|
85
85
|
middleware.use ::ActionDispatch::ContentSecurityPolicy::Middleware
|
|
86
|
-
middleware.use ::ActionDispatch::PermissionsPolicy::Middleware
|
|
86
|
+
middleware.use ::ActionDispatch::PermissionsPolicy::Middleware if config.permissions_policy
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
middleware.use ::Rack::Head
|
data/lib/rails/application.rb
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require "yaml"
|
|
4
4
|
require "active_support/core_ext/hash/keys"
|
|
5
|
-
require "active_support/core_ext/object/blank"
|
|
6
5
|
require "active_support/key_generator"
|
|
7
6
|
require "active_support/message_verifiers"
|
|
8
|
-
require "active_support/deprecation"
|
|
9
7
|
require "active_support/encrypted_configuration"
|
|
10
8
|
require "active_support/hash_with_indifferent_access"
|
|
11
9
|
require "active_support/configuration_file"
|
|
@@ -616,7 +614,7 @@ module Rails
|
|
|
616
614
|
end
|
|
617
615
|
|
|
618
616
|
def railties_initializers(current) # :nodoc:
|
|
619
|
-
initializers =
|
|
617
|
+
initializers = Initializable::Collection.new
|
|
620
618
|
ordered_railties.reverse.flatten.each do |r|
|
|
621
619
|
if r == self
|
|
622
620
|
initializers += current
|
|
@@ -42,8 +42,11 @@ module Rails
|
|
|
42
42
|
|
|
43
43
|
HEADERS = { lines: " Lines", code_lines: " LOC", classes: "Classes", methods: "Methods" }
|
|
44
44
|
|
|
45
|
+
PATTERN = /^(?!\.).*?\.(rb|js|ts|css|scss|coffee|rake|erb)$/
|
|
46
|
+
|
|
45
47
|
class_attribute :directories, default: DIRECTORIES
|
|
46
48
|
class_attribute :test_types, default: TEST_TYPES
|
|
49
|
+
class_attribute :pattern, default: PATTERN
|
|
47
50
|
|
|
48
51
|
# Add directories to the output of the <tt>bin/rails stats</tt> command.
|
|
49
52
|
#
|
|
@@ -81,7 +84,7 @@ module Rails
|
|
|
81
84
|
Hash[@pairs.map { |pair| [pair.first, calculate_directory_statistics(pair.last)] }]
|
|
82
85
|
end
|
|
83
86
|
|
|
84
|
-
def calculate_directory_statistics(directory, pattern =
|
|
87
|
+
def calculate_directory_statistics(directory, pattern = self.class.pattern)
|
|
85
88
|
stats = Rails::CodeStatisticsCalculator.new
|
|
86
89
|
|
|
87
90
|
Dir.foreach(directory) do |file_name|
|