railties 7.2.0 → 8.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +111 -254
- data/lib/minitest/rails_plugin.rb +1 -1
- data/lib/rails/application/configuration.rb +15 -2
- data/lib/rails/application/default_middleware_stack.rb +4 -0
- data/lib/rails/application/finisher.rb +2 -2
- data/lib/rails/application/routes_reloader.rb +11 -1
- data/lib/rails/application.rb +12 -0
- data/lib/rails/code_statistics.rb +128 -86
- data/lib/rails/code_statistics_calculator.rb +78 -76
- data/lib/rails/command/helpers/editor.rb +1 -1
- data/lib/rails/commands/app/update_command.rb +10 -9
- data/lib/rails/commands/console/irb_console.rb +1 -2
- data/lib/rails/commands/credentials/USAGE +4 -4
- data/lib/rails/commands/credentials/credentials_command.rb +5 -1
- data/lib/rails/commands/dev/dev_command.rb +1 -1
- data/lib/rails/commands/devcontainer/devcontainer_command.rb +1 -1
- data/lib/rails/commands/stats/stats_command.rb +19 -0
- data/lib/rails/dev_caching.rb +2 -2
- data/lib/rails/engine/configuration.rb +3 -1
- data/lib/rails/engine/lazy_route_set.rb +109 -0
- data/lib/rails/engine.rb +10 -5
- data/lib/rails/gem_version.rb +3 -3
- data/lib/rails/generators/app_base.rb +46 -24
- data/lib/rails/generators/database.rb +102 -68
- data/lib/rails/generators/erb/authentication/authentication_generator.rb +15 -0
- data/lib/rails/generators/erb/authentication/templates/views/passwords/edit.html.erb +9 -0
- data/lib/rails/generators/erb/authentication/templates/views/passwords/new.html.erb +8 -0
- data/lib/rails/generators/erb/authentication/templates/views/sessions/new.html.erb +11 -0
- data/lib/rails/generators/generated_attribute.rb +16 -11
- data/lib/rails/generators/rails/app/app_generator.rb +22 -32
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +12 -3
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +23 -8
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +6 -11
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +10 -3
- data/lib/rails/generators/rails/app/templates/app/views/pwa/service-worker.js +3 -3
- data/lib/rails/generators/rails/app/templates/bin/dev.tt +1 -0
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +5 -7
- data/lib/rails/generators/rails/app/templates/bin/thrust.tt +4 -0
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +23 -0
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +23 -0
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +40 -0
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +23 -0
- data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +124 -0
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +12 -23
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +34 -51
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +5 -19
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +0 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +25 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +13 -3
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +5 -3
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +4 -3
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +1 -2
- data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/gitignore.tt +1 -2
- data/lib/rails/generators/rails/app/templates/kamal-secrets.tt +17 -0
- data/lib/rails/generators/rails/app/templates/public/400.html +114 -0
- data/lib/rails/generators/rails/app/templates/public/404.html +113 -66
- data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +113 -65
- data/lib/rails/generators/rails/app/templates/public/422.html +113 -66
- data/lib/rails/generators/rails/app/templates/public/500.html +113 -65
- data/lib/rails/generators/rails/app/templates/public/icon.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/icon.svg +2 -2
- data/lib/rails/generators/rails/authentication/USAGE +6 -0
- data/lib/rails/generators/rails/authentication/authentication_generator.rb +54 -0
- data/lib/rails/generators/rails/authentication/templates/controllers/concerns/authentication.rb +55 -0
- data/lib/rails/generators/rails/authentication/templates/controllers/passwords_controller.rb +33 -0
- data/lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb +21 -0
- data/lib/rails/generators/rails/authentication/templates/mailers/passwords_mailer.rb +6 -0
- data/lib/rails/generators/rails/authentication/templates/models/current.rb +4 -0
- data/lib/rails/generators/rails/authentication/templates/models/session.rb +3 -0
- data/lib/rails/generators/rails/authentication/templates/models/user.rb +6 -0
- data/lib/rails/generators/rails/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb +7 -0
- data/lib/rails/generators/rails/authentication/templates/views/passwords_mailer/reset.html.erb +4 -0
- data/lib/rails/generators/rails/authentication/templates/views/passwords_mailer/reset.text.erb +2 -0
- data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +4 -0
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +1 -1
- data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +5 -3
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +1 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +11 -11
- data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +3 -3
- data/lib/rails/generators/rails/script/USAGE +18 -0
- data/lib/rails/generators/rails/script/script_generator.rb +18 -0
- data/lib/rails/generators/rails/script/templates/script.rb.tt +3 -0
- data/lib/rails/generators.rb +7 -2
- data/lib/rails/info_controller.rb +10 -2
- data/lib/rails/rack/silence_request.rb +33 -0
- data/lib/rails/rack.rb +1 -0
- data/lib/rails/railtie.rb +13 -13
- data/lib/rails/source_annotation_extractor.rb +31 -14
- data/lib/rails/tasks/statistics.rake +13 -28
- data/lib/rails/templates/rails/info/notes.html.erb +65 -0
- metadata +45 -25
- data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -2
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/channel.rb.tt +0 -4
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/connection.rb.tt +0 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt +0 -70
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +0 -13
- data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +0 -13
- data/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js.tt +0 -10
- data/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js.tt +0 -6
- data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e33b7c8f20e79a1706cdcad58be19d009563111e20a59f96d8c387d4088883c
|
4
|
+
data.tar.gz: 4490c2625c393ab52a69d98a61caaa3a3b3f5093899e8203dad3d28a8a5dbc99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fd02c87add0fdf9ac0b0a1b5ed6b79a278b258f8d40fc02c912e24d6995a4155bdea1a460b795c180e938a7b9f7af793f23a8ff3feec9cb15c4812101d22ce5
|
7
|
+
data.tar.gz: 4788fa68c076ebb9901afd5fc6e24112939de491353096659b1151d841a37872d17f45b21b659287a976916d1b02a1342f2de536a835108a46559cfbd7af3ba2
|
data/CHANGELOG.md
CHANGED
@@ -1,328 +1,185 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
2
2
|
|
3
|
-
*
|
4
|
-
standard `-e/--environment` options.
|
3
|
+
* Exit `rails g` with code 1 if generator could not be found.
|
5
4
|
|
6
|
-
|
5
|
+
Previously `rails g` returned 0, which would make it harder to catch typos in scripts calling `rails g`.
|
7
6
|
|
8
|
-
*
|
9
|
-
of the application. Usage:
|
7
|
+
*Christopher Özbek*
|
10
8
|
|
11
|
-
|
9
|
+
* Remove `require_*` statements from application.css to align with the transition from Sprockets to Propshaft.
|
12
10
|
|
13
|
-
|
11
|
+
With Propshaft as the default asset pipeline in Rails 8, the require_tree and require_self clauses in application.css are no longer necessary, as they were specific to Sprockets. Additionally, the comment has been updated to clarify that CSS precedence now follows standard cascading order without automatic prioritization by the asset pipeline.
|
14
12
|
|
15
|
-
*
|
16
|
-
This can be skipped using --skip-rubocop and --skip-ci.
|
13
|
+
*Eduardo Alencar*
|
17
14
|
|
18
|
-
|
15
|
+
* Do not include redis by default in generated Dev Containers.
|
19
16
|
|
20
|
-
|
21
|
-
|
17
|
+
Now that applications use the Solid Queue and Solid Cache gems by default, we do not need to include redis
|
18
|
+
in the Dev Container. We will only include redis if `--skip-solid` is used when generating an app that uses
|
19
|
+
Active Job or Action Cable.
|
22
20
|
|
23
|
-
|
21
|
+
When generating a Dev Container for an existing app, we will not include redis if either of the solid gems
|
22
|
+
are in use.
|
24
23
|
|
25
24
|
*Andrew Novoselac*
|
26
25
|
|
27
|
-
*
|
28
|
-
|
29
|
-
`bin/rails app:update` now supports the same generic options that generators do:
|
30
|
-
|
31
|
-
* `--force`: Accept all changes to existing files
|
32
|
-
* `--skip`: Refuse all changes to existing files
|
33
|
-
* `--pretend`: Don't make any changes
|
34
|
-
* `--quiet`: Don't output all changes made
|
35
|
-
|
36
|
-
*Étienne Barrié*
|
37
|
-
|
38
|
-
* Implement Rails console commands and helpers with IRB v1.13's extension APIs.
|
39
|
-
|
40
|
-
Rails console users will now see `helper`, `controller`, `new_session`, and `app` under
|
41
|
-
IRB help message's `Helper methods` category. And `reload!` command will be displayed under
|
42
|
-
the new `Rails console` commands category.
|
43
|
-
|
44
|
-
Prior to this change, Rails console's commands and helper methods are added through IRB's
|
45
|
-
private components and don't show up in its help message, which led to poor discoverability.
|
46
|
-
|
47
|
-
*Stan Lo*
|
48
|
-
|
49
|
-
* Remove deprecated `Rails::Generators::Testing::Behaviour`.
|
50
|
-
|
51
|
-
*Rafael Mendonça França*
|
52
|
-
|
53
|
-
* Remove deprecated `find_cmd_and_exec` console helper.
|
54
|
-
|
55
|
-
*Rafael Mendonça França*
|
56
|
-
|
57
|
-
* Remove deprecated `Rails.config.enable_dependency_loading`.
|
58
|
-
|
59
|
-
*Rafael Mendonça França*
|
60
|
-
|
61
|
-
* Remove deprecated `Rails.application.secrets`.
|
62
|
-
|
63
|
-
*Rafael Mendonça França*
|
64
|
-
|
65
|
-
* Generated Gemfile will include `require: "debug/prelude"` for the `debug` gem.
|
66
|
-
|
67
|
-
Requiring `debug` gem directly automatically activates it, which could introduce
|
68
|
-
additional overhead and memory usage even without entering a debugging session.
|
69
|
-
|
70
|
-
By making Bundler require `debug/prelude` instead, developers can keep their access
|
71
|
-
to breakpoint methods like `debugger` or `binding.break`, but the debugger won't be
|
72
|
-
activated until a breakpoint is hit.
|
73
|
-
|
74
|
-
*Stan Lo*
|
75
|
-
|
76
|
-
* Skip generating a `test` job in ci.yml when a new application is generated with the
|
77
|
-
`--skip-test` option.
|
78
|
-
|
79
|
-
*Steve Polito*
|
26
|
+
* Use [Solid Cable](https://github.com/rails/solid_cable) as the default Action Cable adapter in production, configured as a separate queue database in config/database.yml. It keeps messages in a table and continuously polls for updates. This makes it possible to drop the common dependency on Redis, if it isn't needed for any other purpose. Despite polling, the performance of Solid Cable is comparable to Redis in most situations. And in all circumstances, it makes it easier to deploy Rails when Redis is no longer a required dependency for Action Cable functionality.
|
80
27
|
|
81
|
-
*
|
82
|
-
|
83
|
-
*Steve Polito*
|
84
|
-
|
85
|
-
* Fix sanitizer vendor configuration in 7.1 defaults.
|
86
|
-
|
87
|
-
In apps where rails-html-sanitizer was not eagerly loaded, the sanitizer default could end up
|
88
|
-
being Rails::HTML4::Sanitizer when it should be set to Rails::HTML5::Sanitizer.
|
89
|
-
|
90
|
-
*Mike Dalessio*, *Rafael Mendonça França*
|
91
|
-
|
92
|
-
* Set `action_mailer.default_url_options` values in `development` and `test`.
|
93
|
-
|
94
|
-
Prior to this commit, new Rails applications would raise `ActionView::Template::Error`
|
95
|
-
if a mailer included a url built with a `*_path` helper.
|
96
|
-
|
97
|
-
*Steve Polito*
|
28
|
+
*DHH*
|
98
29
|
|
99
|
-
*
|
30
|
+
* Use [Solid Queue](https://github.com/rails/solid_queue) as the default Active Job backend in production, configured as a separate queue database in config/database.yml. In a single-server deployment, it'll run as a Puma plugin. This is configured in `config/deploy.yml` and can easily be changed to use a dedicated jobs machine.
|
100
31
|
|
101
|
-
|
32
|
+
*DHH*
|
102
33
|
|
103
|
-
|
104
|
-
assert_initializer "mail_interceptors.rb"
|
105
|
-
```
|
34
|
+
* Use [Solid Cache](https://github.com/rails/solid_cache) as the default Rails.cache backend in production, configured as a separate cache database in config/database.yml.
|
106
35
|
|
107
|
-
*
|
36
|
+
*DHH*
|
108
37
|
|
109
|
-
*
|
38
|
+
* Add Rails::Rack::SilenceRequest middleware and use it via `config.silence_healthcheck_path = path`
|
39
|
+
to silence requests to "/up". This prevents the Kamal-required health checks from clogging up
|
40
|
+
the production logs.
|
110
41
|
|
111
|
-
|
42
|
+
*DHH*
|
112
43
|
|
113
|
-
|
114
|
-
- A redis container for Kredis, ActionCable etc.
|
115
|
-
- A database (SQLite, Postgres, MySQL or MariaDB)
|
116
|
-
- A Headless chrome container for system tests
|
117
|
-
- Active Storage configured to use the local disk and with preview features working
|
44
|
+
* Introduce `mariadb-mysql` and `mariadb-trilogy` database options for `rails new`
|
118
45
|
|
119
|
-
|
46
|
+
When used with the `--devcontainer` flag, these options will use `mariadb` as the database for the
|
47
|
+
Dev Container. The original `mysql` and `trilogy` options will use `mysql`. Users who are not
|
48
|
+
generating a Dev Container do not need to use the new options.
|
120
49
|
|
121
|
-
|
50
|
+
*Andrew Novoselac*
|
122
51
|
|
123
|
-
|
52
|
+
* Deprecate `::STATS_DIRECTORIES`.
|
124
53
|
|
125
|
-
|
54
|
+
The global constant `STATS_DIRECTORIES` has been deprecated in favor of
|
55
|
+
`Rails::CodeStatistics.register_directory`.
|
126
56
|
|
127
|
-
|
57
|
+
Add extra directories with `Rails::CodeStatistics.register_directory(label, path)`:
|
128
58
|
|
129
59
|
```ruby
|
130
|
-
|
131
|
-
|
132
|
-
end
|
60
|
+
require "rails/code_statistics"
|
61
|
+
Rails::CodeStatistics.register_directory('My Directory', 'path/to/dir')
|
133
62
|
```
|
134
63
|
|
135
|
-
*
|
64
|
+
*Petrik de Heus*
|
136
65
|
|
137
|
-
*
|
66
|
+
* Enable query log tags by default on development env
|
138
67
|
|
139
|
-
|
68
|
+
This can be used to trace troublesome SQL statements back to the application
|
69
|
+
code that generated these statements. It is also useful when using multiple
|
70
|
+
databases because the query logs can identify which database is being used.
|
140
71
|
|
141
|
-
*
|
72
|
+
*Matheus Richard*
|
142
73
|
|
143
|
-
|
74
|
+
* Defer route drawing to the first request, or when url_helpers are called
|
144
75
|
|
145
|
-
|
76
|
+
Executes the first routes reload in middleware, or when a route set's
|
77
|
+
url_helpers receives a route call / asked if it responds to a route.
|
78
|
+
Previously, this was executed unconditionally on boot, which can
|
79
|
+
slow down boot time unnecessarily for larger apps with lots of routes.
|
146
80
|
|
147
|
-
|
81
|
+
Environments like production that have `config.eager_load = true` will
|
82
|
+
continue to eagerly load routes on boot.
|
148
83
|
|
149
|
-
*
|
150
|
-
rails new generator command. Update ARGVScrubber to ignore text after `#` symbols.
|
84
|
+
*Gannon McGibbon*
|
151
85
|
|
152
|
-
|
86
|
+
* Generate form helpers to use `textarea*` methods instead of `text_area*` methods
|
153
87
|
|
154
|
-
*
|
88
|
+
*Sean Doyle*
|
155
89
|
|
156
|
-
|
90
|
+
* Add authentication generator to give a basic start to an authentication system using database-tracked sessions and password reset.
|
157
91
|
|
158
|
-
|
92
|
+
Generate with...
|
159
93
|
|
160
|
-
```
|
161
|
-
|
162
|
-
my-app(test)> # for RAILS_ENV=test
|
163
|
-
my-app(prod)> # for RAILS_ENV=production
|
164
|
-
my-app(my_env)> # for RAILS_ENV=my_env
|
94
|
+
```
|
95
|
+
bin/rails generate authentication
|
165
96
|
```
|
166
97
|
|
167
|
-
|
168
|
-
For example, `MyApp` will displayed as `my-app` in the prompt.
|
169
|
-
|
170
|
-
Additionally, the environment name will be colorized when the environment is
|
171
|
-
`development` (blue), `test` (blue), or `production` (red), if your
|
172
|
-
terminal supports it.
|
173
|
-
|
174
|
-
*Stan Lo*
|
175
|
-
|
176
|
-
* Ensure `autoload_paths`, `autoload_once_paths`, `eager_load_paths`, and
|
177
|
-
`load_paths` only have directories when initialized from engine defaults.
|
178
|
-
|
179
|
-
Previously, files under the `app` directory could end up there too.
|
180
|
-
|
181
|
-
*Takumasa Ochi*
|
182
|
-
|
183
|
-
* Prevent unnecessary application reloads in development.
|
184
|
-
|
185
|
-
Previously, some files outside autoload paths triggered unnecessary reloads.
|
186
|
-
With this fix, application reloads according to `Rails.autoloaders.main.dirs`,
|
187
|
-
thereby preventing unnecessary reloads.
|
188
|
-
|
189
|
-
*Takumasa Ochi*
|
190
|
-
|
191
|
-
* Use `oven-sh/setup-bun` in GitHub CI when generating an app with Bun.
|
192
|
-
|
193
|
-
*TangRufus*
|
194
|
-
|
195
|
-
* Disable `pidfile` generation in the `production` environment.
|
98
|
+
Generated files:
|
196
99
|
|
197
|
-
|
100
|
+
```
|
101
|
+
app/models/current.rb
|
102
|
+
app/models/user.rb
|
103
|
+
app/models/session.rb
|
104
|
+
app/controllers/sessions_controller.rb
|
105
|
+
app/controllers/passwords_controller.rb
|
106
|
+
app/mailers/passwords_mailer.rb
|
107
|
+
app/views/sessions/new.html.erb
|
108
|
+
app/views/passwords/new.html.erb
|
109
|
+
app/views/passwords/edit.html.erb
|
110
|
+
app/views/passwords_mailer/reset.html.erb
|
111
|
+
app/views/passwords_mailer/reset.text.erb
|
112
|
+
db/migrate/xxxxxxx_create_users.rb
|
113
|
+
db/migrate/xxxxxxx_create_sessions.rb
|
114
|
+
test/mailers/previews/passwords_mailer_preview.rb
|
115
|
+
```
|
198
116
|
|
199
|
-
*
|
200
|
-
the `development` environment.
|
117
|
+
*DHH*
|
201
118
|
|
202
|
-
*Adrian Marin*
|
203
119
|
|
204
|
-
*
|
120
|
+
* Add not-null type modifier to migration attributes.
|
205
121
|
|
206
|
-
|
122
|
+
Generating with...
|
207
123
|
|
208
|
-
```
|
209
|
-
|
124
|
+
```
|
125
|
+
bin/rails generate migration CreateUsers email_address:string!:uniq password_digest:string!
|
210
126
|
```
|
211
127
|
|
212
|
-
|
213
|
-
|
214
|
-
* Raise `ArgumentError` when reading `config.x.something` with arguments:
|
128
|
+
Produces:
|
215
129
|
|
216
130
|
```ruby
|
217
|
-
|
131
|
+
class CreateUsers < ActiveRecord::Migration[8.0]
|
132
|
+
def change
|
133
|
+
create_table :users do |t|
|
134
|
+
t.string :email_address, null: false
|
135
|
+
t.string :password_digest, null: false
|
136
|
+
|
137
|
+
t.timestamps
|
138
|
+
end
|
139
|
+
add_index :users, :email_address, unique: true
|
140
|
+
end
|
141
|
+
end
|
218
142
|
```
|
219
143
|
|
220
|
-
*Sean Doyle*
|
221
|
-
|
222
|
-
* Add default PWA files for manifest and service-worker that are served from `app/views/pwa` and can be dynamically rendered through ERB. Mount these files explicitly at the root with default routes in the generated routes file.
|
223
|
-
|
224
144
|
*DHH*
|
225
145
|
|
226
|
-
*
|
227
|
-
|
228
|
-
*DHH*
|
229
|
-
|
230
|
-
* Add GitHub CI files for Dependabot, Brakeman, RuboCop, and running tests by default. Can be skipped with `--skip-ci`.
|
231
|
-
|
232
|
-
*DHH*
|
233
|
-
|
234
|
-
* Add Brakeman by default for static analysis of security vulnerabilities. Allow skipping with `--skip-brakeman option`.
|
235
|
-
|
236
|
-
*vipulnsward*
|
237
|
-
|
238
|
-
* Add RuboCop with rules from `rubocop-rails-omakase` by default. Skip with `--skip-rubocop`.
|
239
|
-
|
240
|
-
*DHH* and *zzak*
|
241
|
-
|
242
|
-
* Use `bin/rails runner --skip-executor` to not wrap the runner script with an
|
243
|
-
Executor.
|
244
|
-
|
245
|
-
*Ben Sheldon*
|
246
|
-
|
247
|
-
* Fix isolated engines to take `ActiveRecord::Base.table_name_prefix` into consideration.
|
248
|
-
|
249
|
-
This will allow for engine defined models, such as inside Active Storage, to respect
|
250
|
-
Active Record table name prefix configuration.
|
251
|
-
|
252
|
-
*Chedli Bourguiba*
|
146
|
+
* Add a `script` folder to applications, and a scripts generator.
|
253
147
|
|
254
|
-
|
148
|
+
The new `script` folder is meant to hold one-off or general purpose scripts,
|
149
|
+
such as data migration scripts, cleanup scripts, etc.
|
255
150
|
|
256
|
-
|
257
|
-
|
258
|
-
* In Action Mailer previews, list inline attachments separately from normal
|
259
|
-
attachments.
|
260
|
-
|
261
|
-
For example, attachments that were previously listed like
|
262
|
-
|
263
|
-
> Attachments: logo.png file1.pdf file2.pdf
|
264
|
-
|
265
|
-
will now be listed like
|
266
|
-
|
267
|
-
> Attachments: file1.pdf file2.pdf (Inline: logo.png)
|
268
|
-
|
269
|
-
*Christian Schmidt* and *Jonathan Hefner*
|
270
|
-
|
271
|
-
* In mailer preview, only show SMTP-To if it differs from the union of To, Cc and Bcc.
|
272
|
-
|
273
|
-
*Christian Schmidt*
|
274
|
-
|
275
|
-
* Enable YJIT by default on new applications running Ruby 3.3+.
|
276
|
-
|
277
|
-
This can be disabled by setting `Rails.application.config.yjit = false`
|
278
|
-
|
279
|
-
*Jean Boussier*, *Rafael Mendonça França*
|
280
|
-
|
281
|
-
* In Action Mailer previews, show date from message `Date` header if present.
|
282
|
-
|
283
|
-
*Sampat Badhe*
|
284
|
-
|
285
|
-
* Exit with non-zero status when the migration generator fails.
|
286
|
-
|
287
|
-
*Katsuhiko YOSHIDA*
|
288
|
-
|
289
|
-
* Use numeric UID and GID in Dockerfile template.
|
290
|
-
|
291
|
-
The Dockerfile generated by `rails new` sets the default user and group
|
292
|
-
by name instead of UID:GID. This can cause the following error in Kubernetes:
|
151
|
+
A new script generator allows you to create such scripts:
|
293
152
|
|
294
153
|
```
|
295
|
-
|
154
|
+
bin/rails generate script my_script
|
155
|
+
bin/rails generate script data/backfill
|
296
156
|
```
|
297
157
|
|
298
|
-
|
299
|
-
|
300
|
-
*Ivan Fedotov*
|
158
|
+
You can run the generated script using:
|
301
159
|
|
302
|
-
|
160
|
+
```
|
161
|
+
bundle exec ruby script/my_script.rb
|
162
|
+
bundle exec ruby script/data/backfill.rb
|
163
|
+
```
|
303
164
|
|
304
|
-
|
305
|
-
for `rails new` take different arguments. This change validates them.
|
165
|
+
*Jerome Dalbert*, *Haroon Ahmed*
|
306
166
|
|
307
|
-
|
167
|
+
* Deprecate `bin/rake stats` in favor of `bin/rails stats`.
|
308
168
|
|
309
|
-
*
|
169
|
+
*Juan Vásquez*
|
310
170
|
|
311
|
-
|
312
|
-
generator tests, we add the ability to conditionally print `$stdout`
|
313
|
-
instead of capturing it.
|
171
|
+
* Add internal page `/rails/info/notes`, that displays the same information as `bin/rails notes`.
|
314
172
|
|
315
|
-
|
173
|
+
*Deepak Mahakale*
|
316
174
|
|
317
|
-
|
318
|
-
|
319
|
-
```
|
175
|
+
* Add Rubocop and GitHub Actions to plugin generator.
|
176
|
+
This can be skipped using --skip-rubocop and --skip-ci.
|
320
177
|
|
321
|
-
*
|
178
|
+
*Chris Oliver*
|
322
179
|
|
323
|
-
*
|
324
|
-
|
180
|
+
* Use Kamal for deployment by default, which includes generating a Rails-specific config/deploy.yml.
|
181
|
+
This can be skipped using --skip-kamal. See more: https://kamal-deploy.org/
|
325
182
|
|
326
|
-
*
|
183
|
+
*DHH*
|
327
184
|
|
328
|
-
Please check [7-
|
185
|
+
Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/railties/CHANGELOG.md) for previous changes.
|
@@ -110,7 +110,7 @@ module Minitest
|
|
110
110
|
# minitest-reporters, maxitest, and others.
|
111
111
|
def self.plugin_rails_init(options)
|
112
112
|
# Don't mess with Minitest unless RAILS_ENV is set
|
113
|
-
return unless ENV["RAILS_ENV"]
|
113
|
+
return unless ENV["RAILS_ENV"] || ENV["RAILS_MINITEST_PLUGIN"]
|
114
114
|
|
115
115
|
unless options[:full_backtrace]
|
116
116
|
# Plugin can run without Rails loaded, check before filtering.
|
@@ -15,7 +15,7 @@ module Rails
|
|
15
15
|
:cache_classes, :cache_store, :consider_all_requests_local, :console,
|
16
16
|
:eager_load, :exceptions_app, :file_watcher, :filter_parameters, :precompile_filter_parameters,
|
17
17
|
:force_ssl, :helpers_paths, :hosts, :host_authorization, :logger, :log_formatter,
|
18
|
-
:log_tags, :railties_order, :relative_url_root,
|
18
|
+
:log_tags, :silence_healthcheck_path, :railties_order, :relative_url_root,
|
19
19
|
:ssl_options, :public_file_server,
|
20
20
|
:session_options, :time_zone, :reload_classes_only_on_change,
|
21
21
|
:beginning_of_week, :filter_redirect, :x,
|
@@ -62,6 +62,7 @@ module Rails
|
|
62
62
|
@exceptions_app = nil
|
63
63
|
@autoflush_log = true
|
64
64
|
@log_formatter = ActiveSupport::Logger::SimpleFormatter.new
|
65
|
+
@silence_healthcheck_path = nil
|
65
66
|
@eager_load = nil
|
66
67
|
@secret_key_base = nil
|
67
68
|
@api_only = false
|
@@ -114,7 +115,9 @@ module Rails
|
|
114
115
|
action_controller.forgery_protection_origin_check = true
|
115
116
|
end
|
116
117
|
|
117
|
-
|
118
|
+
if respond_to?(:active_support)
|
119
|
+
active_support.to_time_preserves_timezone = :offset
|
120
|
+
end
|
118
121
|
|
119
122
|
if respond_to?(:active_record)
|
120
123
|
active_record.belongs_to_required_by_default = true
|
@@ -335,6 +338,16 @@ module Rails
|
|
335
338
|
active_record.postgresql_adapter_decode_dates = true
|
336
339
|
active_record.validate_migration_timestamps = true
|
337
340
|
end
|
341
|
+
when "8.0"
|
342
|
+
load_defaults "7.2"
|
343
|
+
|
344
|
+
if respond_to?(:active_support)
|
345
|
+
active_support.to_time_preserves_timezone = :zone
|
346
|
+
end
|
347
|
+
|
348
|
+
if respond_to?(:action_dispatch)
|
349
|
+
action_dispatch.strict_freshness = true
|
350
|
+
end
|
338
351
|
else
|
339
352
|
raise "Unknown version #{target_version.to_s.inspect}"
|
340
353
|
end
|
@@ -54,6 +54,10 @@ module Rails
|
|
54
54
|
middleware.use ::ActionDispatch::RequestId, header: config.action_dispatch.request_id_header
|
55
55
|
middleware.use ::ActionDispatch::RemoteIp, config.action_dispatch.ip_spoofing_check, config.action_dispatch.trusted_proxies
|
56
56
|
|
57
|
+
if path = config.silence_healthcheck_path
|
58
|
+
middleware.use ::Rails::Rack::SilenceRequest, path: path
|
59
|
+
end
|
60
|
+
|
57
61
|
middleware.use ::Rails::Rack::Logger, config.log_tags
|
58
62
|
middleware.use ::ActionDispatch::ShowExceptions, show_exceptions_app
|
59
63
|
middleware.use ::ActionDispatch::DebugExceptions, app, config.debug_exception_response_format
|
@@ -143,6 +143,7 @@ module Rails
|
|
143
143
|
app.routes.prepend do
|
144
144
|
get "/rails/info/properties" => "rails/info#properties", internal: true
|
145
145
|
get "/rails/info/routes" => "rails/info#routes", internal: true
|
146
|
+
get "/rails/info/notes" => "rails/info#notes", internal: true
|
146
147
|
get "/rails/info" => "rails/info#index", internal: true
|
147
148
|
end
|
148
149
|
|
@@ -159,7 +160,6 @@ module Rails
|
|
159
160
|
initializer :set_routes_reloader_hook do |app|
|
160
161
|
reloader = routes_reloader
|
161
162
|
reloader.eager_load = app.config.eager_load
|
162
|
-
reloader.execute
|
163
163
|
reloaders << reloader
|
164
164
|
|
165
165
|
app.reloader.to_run do
|
@@ -177,7 +177,7 @@ module Rails
|
|
177
177
|
ActiveSupport.run_load_hooks(:after_routes_loaded, self)
|
178
178
|
end
|
179
179
|
|
180
|
-
|
180
|
+
reloader.execute_unless_loaded if !app.routes.is_a?(Engine::LazyRouteSet) || app.config.eager_load
|
181
181
|
end
|
182
182
|
|
183
183
|
# Set clearing dependencies after the finisher hook to ensure paths
|
@@ -7,7 +7,7 @@ module Rails
|
|
7
7
|
class RoutesReloader
|
8
8
|
include ActiveSupport::Callbacks
|
9
9
|
|
10
|
-
attr_reader :route_sets, :paths, :external_routes
|
10
|
+
attr_reader :route_sets, :paths, :external_routes, :loaded
|
11
11
|
attr_accessor :eager_load
|
12
12
|
attr_writer :run_after_load_paths # :nodoc:
|
13
13
|
delegate :execute_if_updated, :execute, :updated?, to: :updater
|
@@ -17,9 +17,11 @@ module Rails
|
|
17
17
|
@route_sets = []
|
18
18
|
@external_routes = []
|
19
19
|
@eager_load = false
|
20
|
+
@loaded = false
|
20
21
|
end
|
21
22
|
|
22
23
|
def reload!
|
24
|
+
@loaded = true
|
23
25
|
clear!
|
24
26
|
load_paths
|
25
27
|
finalize!
|
@@ -28,6 +30,14 @@ module Rails
|
|
28
30
|
revert
|
29
31
|
end
|
30
32
|
|
33
|
+
def execute_unless_loaded
|
34
|
+
unless @loaded
|
35
|
+
execute
|
36
|
+
ActiveSupport.run_load_hooks(:after_routes_loaded, Rails.application)
|
37
|
+
true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
31
41
|
private
|
32
42
|
def updater
|
33
43
|
@updater ||= begin
|
data/lib/rails/application.rb
CHANGED
@@ -9,6 +9,7 @@ require "active_support/deprecation"
|
|
9
9
|
require "active_support/encrypted_configuration"
|
10
10
|
require "active_support/hash_with_indifferent_access"
|
11
11
|
require "active_support/configuration_file"
|
12
|
+
require "active_support/parameter_filter"
|
12
13
|
require "rails/engine"
|
13
14
|
require "rails/autoloaders"
|
14
15
|
|
@@ -134,6 +135,13 @@ module Rails
|
|
134
135
|
@initialized
|
135
136
|
end
|
136
137
|
|
138
|
+
# Returns the dasherized application name.
|
139
|
+
#
|
140
|
+
# MyApp::Application.new.name => "my-app"
|
141
|
+
def name
|
142
|
+
self.class.name.underscore.dasherize.delete_suffix("/application")
|
143
|
+
end
|
144
|
+
|
137
145
|
def run_load_hooks! # :nodoc:
|
138
146
|
return self if @ran_load_hooks
|
139
147
|
@ran_load_hooks = true
|
@@ -153,6 +161,10 @@ module Rails
|
|
153
161
|
routes_reloader.reload!
|
154
162
|
end
|
155
163
|
|
164
|
+
def reload_routes_unless_loaded # :nodoc:
|
165
|
+
initialized? && routes_reloader.execute_unless_loaded
|
166
|
+
end
|
167
|
+
|
156
168
|
# Returns a key generator (ActiveSupport::CachingKeyGenerator) for a
|
157
169
|
# specified +secret_key_base+. The return value is memoized, so additional
|
158
170
|
# calls with the same +secret_key_base+ will return the same key generator
|