railties 6.0.4 → 6.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +248 -375
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.rdoc +1 -1
- data/lib/minitest/rails_plugin.rb +16 -1
- data/lib/rails/application/bootstrap.rb +5 -5
- data/lib/rails/application/configuration.rb +77 -24
- data/lib/rails/application/default_middleware_stack.rb +5 -3
- data/lib/rails/application/finisher.rb +15 -2
- data/lib/rails/application/routes_reloader.rb +9 -2
- data/lib/rails/application.rb +53 -80
- data/lib/rails/backtrace_cleaner.rb +12 -7
- data/lib/rails/code_statistics.rb +3 -3
- data/lib/rails/code_statistics_calculator.rb +6 -6
- data/lib/rails/command/base.rb +1 -1
- data/lib/rails/command/behavior.rb +1 -1
- data/lib/rails/command/environment_argument.rb +1 -1
- data/lib/rails/command.rb +5 -1
- data/lib/rails/commands/credentials/USAGE +17 -2
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +41 -0
- data/lib/rails/commands/credentials/credentials_command.rb +28 -4
- data/lib/rails/commands/db/system/change/change_command.rb +6 -1
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +61 -58
- data/lib/rails/commands/encrypted/encrypted_command.rb +4 -4
- data/lib/rails/commands/generate/generate_command.rb +1 -1
- data/lib/rails/commands/notes/notes_command.rb +1 -11
- data/lib/rails/commands/rake/rake_command.rb +9 -8
- data/lib/rails/commands/secrets/USAGE +9 -3
- data/lib/rails/commands/server/server_command.rb +14 -41
- data/lib/rails/commands/test/test_command.rb +2 -2
- data/lib/rails/configuration.rb +40 -10
- data/lib/rails/engine/configuration.rb +1 -0
- data/lib/rails/engine/updater.rb +1 -1
- data/lib/rails/engine.rb +35 -32
- data/lib/rails/gem_version.rb +1 -1
- data/lib/rails/generators/actions/create_migration.rb +7 -0
- data/lib/rails/generators/actions.rb +50 -29
- data/lib/rails/generators/app_base.rb +48 -23
- data/lib/rails/generators/base.rb +14 -11
- data/lib/rails/generators/database.rb +3 -4
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +3 -3
- data/lib/rails/generators/generated_attribute.rb +3 -9
- data/lib/rails/generators/migration.rb +2 -1
- data/lib/rails/generators/model_helpers.rb +26 -2
- data/lib/rails/generators/named_base.rb +1 -1
- data/lib/rails/generators/rails/app/USAGE +2 -1
- data/lib/rails/generators/rails/app/app_generator.rb +87 -15
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +11 -11
- data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +1 -1
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +11 -11
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +2 -1
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +4 -4
- data/lib/rails/generators/rails/app/templates/bin/spring.tt +13 -0
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +9 -3
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +14 -7
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +3 -4
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +10 -9
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +10 -9
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +10 -9
- data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +17 -3
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +15 -5
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +12 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +4 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +67 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +6 -1
- data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +14 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +0 -1
- data/lib/rails/generators/rails/app/templates/package.json.tt +1 -1
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +5 -5
- data/lib/rails/generators/rails/assets/USAGE +2 -3
- data/lib/rails/generators/rails/benchmark/USAGE +19 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +29 -0
- data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
- data/lib/rails/generators/rails/controller/USAGE +2 -2
- data/lib/rails/generators/rails/controller/controller_generator.rb +2 -40
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +1 -1
- data/lib/rails/generators/rails/generator/USAGE +2 -2
- data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
- data/lib/rails/generators/rails/helper/USAGE +2 -3
- data/lib/rails/generators/rails/integration_test/USAGE +2 -2
- data/lib/rails/generators/rails/migration/USAGE +4 -4
- data/lib/rails/generators/rails/model/USAGE +15 -16
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +25 -23
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +10 -19
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +3 -10
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +0 -1
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +3 -3
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +13 -11
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
- data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
- data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +0 -3
- data/lib/rails/generators/rails/resource/USAGE +4 -4
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
- data/lib/rails/generators/rails/scaffold/USAGE +5 -5
- data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +6 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -1
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +1 -1
- data/lib/rails/generators/rails/system_test/USAGE +2 -2
- data/lib/rails/generators/rails/task/USAGE +3 -3
- data/lib/rails/generators/test_case.rb +1 -1
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
- data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/testing/assertions.rb +2 -2
- data/lib/rails/generators/testing/behaviour.rb +1 -1
- data/lib/rails/generators.rb +29 -15
- data/lib/rails/info.rb +1 -1
- data/lib/rails/info_controller.rb +1 -1
- data/lib/rails/mailers_controller.rb +1 -0
- data/lib/rails/paths.rb +14 -6
- data/lib/rails/railtie/configuration.rb +3 -2
- data/lib/rails/railtie.rb +31 -10
- data/lib/rails/source_annotation_extractor.rb +2 -16
- data/lib/rails/tasks/engine.rake +1 -4
- data/lib/rails/tasks/framework.rake +7 -1
- data/lib/rails/tasks/misc.rake +1 -1
- data/lib/rails/tasks/statistics.rake +1 -1
- data/lib/rails/tasks/yarn.rake +14 -2
- data/lib/rails/tasks.rb +0 -4
- data/lib/rails/templates/rails/mailers/email.html.erb +1 -0
- data/lib/rails/templates/rails/welcome/index.html.erb +1 -1
- data/lib/rails/test_unit/reporter.rb +2 -1
- data/lib/rails/test_unit/runner.rb +12 -3
- data/lib/rails/test_unit/testing.rake +6 -0
- data/lib/rails.rb +5 -8
- metadata +25 -31
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +0 -45
- data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
- data/lib/rails/tasks/annotations.rake +0 -22
- data/lib/rails/tasks/dev.rake +0 -11
- data/lib/rails/tasks/initializers.rake +0 -9
- data/lib/rails/tasks/routes.rake +0 -9
data/CHANGELOG.md
CHANGED
@@ -1,554 +1,427 @@
|
|
1
|
-
## Rails 6.
|
1
|
+
## Rails 6.1.4 (June 24, 2021) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Fix compatibility with `psych >= 4`.
|
4
4
|
|
5
|
-
|
5
|
+
Starting in Psych 4.0.0 `YAML.load` behaves like `YAML.safe_load`. To preserve compatibility
|
6
|
+
`Rails.application.config_for` now uses `YAML.unsafe_load` if available.
|
6
7
|
|
7
|
-
*
|
8
|
+
*Jean Boussier*
|
8
9
|
|
9
|
-
|
10
|
+
* Ensure `Rails.application.config_for` always cast hashes to `ActiveSupport::OrderedOptions`.
|
10
11
|
|
11
|
-
*
|
12
|
+
*Jean Boussier*
|
12
13
|
|
14
|
+
* Fix create migration generator with `--pretend` option.
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
* No changes.
|
16
|
+
*euxx*
|
17
17
|
|
18
18
|
|
19
|
-
## Rails 6.
|
19
|
+
## Rails 6.1.3.2 (May 05, 2021) ##
|
20
20
|
|
21
21
|
* No changes.
|
22
22
|
|
23
23
|
|
24
|
-
## Rails 6.
|
24
|
+
## Rails 6.1.3.1 (March 26, 2021) ##
|
25
25
|
|
26
26
|
* No changes.
|
27
27
|
|
28
28
|
|
29
|
-
|
30
|
-
## Rails 6.0.3.4 (October 07, 2020) ##
|
29
|
+
## Rails 6.1.3 (February 17, 2021) ##
|
31
30
|
|
32
31
|
* No changes.
|
33
32
|
|
34
33
|
|
35
|
-
## Rails 6.
|
34
|
+
## Rails 6.1.2.1 (February 10, 2021) ##
|
36
35
|
|
37
36
|
* No changes.
|
38
37
|
|
39
38
|
|
40
|
-
## Rails 6.
|
39
|
+
## Rails 6.1.2 (February 09, 2021) ##
|
41
40
|
|
42
41
|
* No changes.
|
43
42
|
|
44
43
|
|
45
|
-
## Rails 6.
|
44
|
+
## Rails 6.1.1 (January 07, 2021) ##
|
46
45
|
|
47
|
-
*
|
46
|
+
* Allow spaces in path to Yarn binstub and only run on precompile if needed.
|
48
47
|
|
48
|
+
*Markus Doits*
|
49
49
|
|
50
|
-
|
50
|
+
* Populate ARGV for app template.
|
51
51
|
|
52
|
-
|
52
|
+
Fixes #40945.
|
53
53
|
|
54
|
-
|
55
|
-
disabled in `environments/test.rb`. This implicitly disables caching
|
56
|
-
view templates too. This change will enable view template caching by
|
57
|
-
adding this to the generated `environments/test.rb`:
|
54
|
+
*Jonathan Hefner*
|
58
55
|
|
59
|
-
````ruby
|
60
|
-
config.action_view.cache_template_loading = true
|
61
|
-
````
|
62
56
|
|
63
|
-
|
57
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
64
58
|
|
65
|
-
* `
|
66
|
-
|
59
|
+
* Added `Railtie#server` hook called when Rails starts a server.
|
60
|
+
This is useful in case your application or a library needs to run
|
61
|
+
another process next to the Rails server. This is quite common in development
|
62
|
+
for instance to run the Webpack or the React server.
|
67
63
|
|
68
|
-
|
69
|
-
runs when Rails boots with eager loading enabled, you can think of this
|
70
|
-
method as a vanilla recursive code loader.
|
64
|
+
It can be used like this:
|
71
65
|
|
72
|
-
|
73
|
-
|
66
|
+
```ruby
|
67
|
+
class MyRailtie < Rails::Railtie
|
68
|
+
server do
|
69
|
+
WebpackServer.run
|
70
|
+
end
|
71
|
+
end
|
72
|
+
```
|
74
73
|
|
75
|
-
*
|
74
|
+
*Edouard Chin*
|
76
75
|
|
77
|
-
*
|
76
|
+
* Remove deprecated `rake dev:cache` tasks.
|
78
77
|
|
79
|
-
*
|
80
|
-
|
81
|
-
* Regression fix: The Rake task `zeitwerk:check` supports eager loaded
|
82
|
-
namespaces which do not have eager load paths, like the recently added
|
83
|
-
`i18n`. These namespaces are only required to respond to `eager_load!`.
|
78
|
+
*Rafael Mendonça França*
|
84
79
|
|
85
|
-
|
80
|
+
* Remove deprecated `rake routes` tasks.
|
86
81
|
|
82
|
+
*Rafael Mendonça França*
|
87
83
|
|
88
|
-
|
84
|
+
* Remove deprecated `rake initializers` tasks.
|
89
85
|
|
90
|
-
*
|
86
|
+
*Rafael Mendonça França*
|
91
87
|
|
88
|
+
* Remove deprecated support for using the `HOST` environment variable to specify the server IP.
|
92
89
|
|
93
|
-
|
90
|
+
*Rafael Mendonça França*
|
94
91
|
|
95
|
-
*
|
92
|
+
* Remove deprecated `server` argument from the rails server command.
|
96
93
|
|
94
|
+
*Rafael Mendonça França*
|
97
95
|
|
98
|
-
|
96
|
+
* Remove deprecated `SOURCE_ANNOTATION_DIRECTORIES` environment variable support from `rails notes`.
|
99
97
|
|
100
|
-
*
|
98
|
+
*Rafael Mendonça França*
|
101
99
|
|
102
|
-
|
100
|
+
* Remove deprecated `connection` option in the `rails dbconsole` command.
|
103
101
|
|
104
|
-
|
102
|
+
*Rafael Mendonça França*
|
105
103
|
|
106
|
-
*
|
107
|
-
directory, as in engines loaded from gems.
|
104
|
+
* Remove depreated `rake notes` tasks.
|
108
105
|
|
109
|
-
*
|
106
|
+
*Rafael Mendonça França*
|
110
107
|
|
111
|
-
*
|
108
|
+
* Return a 405 Method Not Allowed response when a request uses an unknown HTTP method.
|
112
109
|
|
113
|
-
|
110
|
+
Fixes #38998.
|
114
111
|
|
115
|
-
*
|
116
|
-
included in the default `.gitignore` file for newly-generated apps.
|
112
|
+
*Loren Norman*
|
117
113
|
|
118
|
-
|
114
|
+
* Make railsrc file location xdg-specification compliant
|
119
115
|
|
120
|
-
|
121
|
-
|
116
|
+
`rails new` will now look for the default `railsrc` file at
|
117
|
+
`$XDG_CONFIG_HOME/rails/railsrc` (or `~/.config/rails/railsrc` if
|
118
|
+
`XDG_CONFIG_HOME` is not set). If this file does not exist, `rails new`
|
119
|
+
will fall back to `~/.railsrc`.
|
122
120
|
|
123
|
-
|
121
|
+
The fallback behaviour means this does not cause any breaking changes.
|
124
122
|
|
123
|
+
*Nick Wolf*
|
125
124
|
|
126
|
-
|
125
|
+
* Change the default logging level from :debug to :info to avoid inadvertent exposure of personally
|
126
|
+
identifiable information (PII) in production environments.
|
127
127
|
|
128
|
-
*
|
129
|
-
loaders printed to standard output. May be handy for troubleshooting.
|
128
|
+
*Eric M. Payne*
|
130
129
|
|
131
|
-
|
130
|
+
* Automatically generate abstract class when using multiple databases.
|
132
131
|
|
132
|
+
When generating a scaffold for a multiple database application, Rails will now automatically generate the abstract class for the database when the database argument is passed. This abstract class will include the connection information for the writing configuration and any models generated for that database will automatically inherit from the abstract class.
|
133
133
|
|
134
|
-
|
134
|
+
Usage:
|
135
135
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
mode early, in `config/application.rb`.
|
136
|
+
```bash
|
137
|
+
$ bin/rails generate scaffold Pet name:string --database=animals
|
138
|
+
```
|
140
139
|
|
141
|
-
|
142
|
-
`:zeitwerk` mode do not need `require_dependency`, so models, controllers,
|
143
|
-
jobs, etc. do not need to be in `$LOAD_PATH`. Setting this to `false` saves
|
144
|
-
Ruby from checking these directories when resolving `require` calls with
|
145
|
-
relative paths, and saves Bootsnap work and RAM, since it does not need to
|
146
|
-
build an index for them.
|
140
|
+
Will create an abstract class for the animals connection.
|
147
141
|
|
148
|
-
|
142
|
+
```ruby
|
143
|
+
class AnimalsRecord < ApplicationRecord
|
144
|
+
self.abstract_class = true
|
149
145
|
|
150
|
-
|
146
|
+
connects_to database: { writing: :animals }
|
147
|
+
end
|
148
|
+
```
|
151
149
|
|
152
|
-
|
150
|
+
And generate a `Pet` model that inherits from the new `AnimalsRecord`:
|
153
151
|
|
154
|
-
```
|
155
|
-
|
152
|
+
```ruby
|
153
|
+
class Pet < AnimalsRecord
|
154
|
+
end
|
156
155
|
```
|
157
156
|
|
158
|
-
|
159
|
-
autoloader is compatible with `:zeitwerk` mode.
|
157
|
+
If you already have an abstract class and it follows a different pattern than Rails defaults, you can pass a parent class with the database argument.
|
160
158
|
|
161
|
-
|
159
|
+
```bash
|
160
|
+
$ bin/rails generate scaffold Pet name:string --database=animals --parent=SecondaryBase
|
161
|
+
```
|
162
162
|
|
163
|
-
|
163
|
+
This will ensure the model inherits from the `SecondaryBase` parent instead of `AnimalsRecord`
|
164
164
|
|
165
|
-
|
165
|
+
```ruby
|
166
|
+
class Pet < SecondaryBase
|
167
|
+
end
|
168
|
+
```
|
166
169
|
|
167
|
-
*
|
170
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
168
171
|
|
169
|
-
*
|
170
|
-
`belongs_to` / `references` association generated by model generator.
|
172
|
+
* Accept params from url to prepopulate the Inbound Emails form in Rails conductor.
|
171
173
|
|
172
|
-
|
174
|
+
*Chris Oliver*
|
173
175
|
|
174
|
-
|
176
|
+
* Create a new rails app using a minimal stack.
|
175
177
|
|
176
|
-
|
177
|
-
unless `--skip-spring`.
|
178
|
+
`rails new cool_app --minimal`
|
178
179
|
|
179
|
-
|
180
|
+
All the following are excluded from your minimal stack:
|
180
181
|
|
181
|
-
|
182
|
+
- action_cable
|
183
|
+
- action_mailbox
|
184
|
+
- action_mailer
|
185
|
+
- action_text
|
186
|
+
- active_job
|
187
|
+
- active_storage
|
188
|
+
- bootsnap
|
189
|
+
- jbuilder
|
190
|
+
- spring
|
191
|
+
- system_tests
|
192
|
+
- turbolinks
|
193
|
+
- webpack
|
182
194
|
|
183
|
-
*
|
195
|
+
*Haroon Ahmed*, *DHH*
|
184
196
|
|
185
|
-
*
|
197
|
+
* Add default ENV variable option with BACKTRACE to turn off backtrace cleaning when debugging framework code in the
|
198
|
+
generated config/initializers/backtrace_silencers.rb.
|
186
199
|
|
187
|
-
|
200
|
+
`BACKTRACE=1 ./bin/rails runner "MyClass.perform"`
|
188
201
|
|
189
|
-
*
|
190
|
-
favor of `database` option.
|
202
|
+
*DHH*
|
191
203
|
|
192
|
-
|
204
|
+
* The autoloading guide for Zeitwerk mode documents how to autoload classes
|
205
|
+
during application boot in a safe way.
|
193
206
|
|
194
|
-
*
|
195
|
-
`chromedriver-helper` is deprecated as of March 31, 2019 and won't
|
196
|
-
receive any further updates.
|
207
|
+
*Haroon Ahmed*, *Xavier Noria*
|
197
208
|
|
198
|
-
|
209
|
+
* The `classic` autoloader starts its deprecation cycle.
|
199
210
|
|
200
|
-
|
201
|
-
to upgrade `bootsnap` to at least 1.4.2.
|
211
|
+
New Rails projects are strongly discouraged from using `classic`, and we recommend that existing projects running on `classic` switch to `zeitwerk` mode when upgrading. Please check the [_Upgrading Ruby on Rails_](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html) guide for tips.
|
202
212
|
|
203
213
|
*Xavier Noria*
|
204
214
|
|
205
|
-
*
|
215
|
+
* Adds `rails test:all` for running all tests in the test directory.
|
216
|
+
|
217
|
+
This runs all test files in the test directory, including system tests.
|
206
218
|
|
207
|
-
|
208
|
-
developer from accidentally starting a sandbox console,
|
209
|
-
which when left inactive, can cause the database server to run out of memory.
|
219
|
+
*Niklas Häusele*
|
210
220
|
|
211
|
-
|
221
|
+
* Add `config.generators.after_generate` for processing to generated files.
|
212
222
|
|
213
|
-
|
223
|
+
Register a callback that will get called right after generators has finished.
|
214
224
|
|
215
225
|
*Yuji Yaginuma*
|
216
226
|
|
227
|
+
* Make test file patterns configurable via Environment variables
|
217
228
|
|
218
|
-
|
229
|
+
This makes test file patterns configurable via two environment variables:
|
230
|
+
`DEFAULT_TEST`, to configure files to test, and `DEFAULT_TEST_EXCLUDE`,
|
231
|
+
to configure files to exclude from testing.
|
219
232
|
|
220
|
-
|
233
|
+
These values were hardcoded before, which made it difficult to add
|
234
|
+
new categories of tests that should not be executed by default (e.g:
|
235
|
+
smoke tests).
|
221
236
|
|
222
|
-
|
237
|
+
*Jorge Manrubia*
|
223
238
|
|
224
|
-
|
225
|
-
remote code execution.
|
239
|
+
* No longer include `rake rdoc` task when generating plugins.
|
226
240
|
|
227
|
-
|
241
|
+
To generate docs, use the `rdoc lib` command instead.
|
228
242
|
|
229
|
-
*
|
243
|
+
*Jonathan Hefner*
|
230
244
|
|
245
|
+
* Allow relative paths with trailing slashes to be passed to `rails test`.
|
231
246
|
|
232
|
-
|
247
|
+
*Eugene Kenny*
|
233
248
|
|
234
|
-
*
|
235
|
-
being broken by allowing non-symbol access with a deprecation notice.
|
249
|
+
* Add `rack-mini-profiler` gem to the default `Gemfile`.
|
236
250
|
|
237
|
-
|
251
|
+
`rack-mini-profiler` displays performance information such as SQL time and flame graphs.
|
252
|
+
It's enabled by default in development environment, but can be enabled in production as well.
|
253
|
+
See the gem [README](https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md) for information on how to enable it in production.
|
238
254
|
|
239
|
-
*
|
255
|
+
*Osama Sayegh*
|
240
256
|
|
241
|
-
|
257
|
+
* `rails stats` will now count TypeScript files toward JavaScript stats.
|
242
258
|
|
259
|
+
*Joshua Cody*
|
243
260
|
|
244
|
-
|
261
|
+
* Run `git init` when generating plugins.
|
245
262
|
|
246
|
-
|
263
|
+
Opt out with `--skip-git`.
|
247
264
|
|
248
|
-
*
|
265
|
+
*OKURA Masafumi*
|
249
266
|
|
250
|
-
*
|
267
|
+
* Add benchmark generator.
|
251
268
|
|
252
|
-
|
269
|
+
Introduce benchmark generator to benchmark Rails applications.
|
253
270
|
|
254
|
-
|
271
|
+
`rails generate benchmark opt_compare`
|
255
272
|
|
256
|
-
|
273
|
+
This creates a benchmark file that uses [`benchmark-ips`](https://github.com/evanphx/benchmark-ips).
|
274
|
+
By default, two code blocks can be benchmarked using the `before` and `after` reports.
|
257
275
|
|
258
|
-
|
276
|
+
You can run the generated benchmark file using:
|
277
|
+
`ruby script/benchmarks/opt_compare.rb`
|
259
278
|
|
260
|
-
*
|
261
|
-
|
262
|
-
* Remove deprecated `config.secret_token`.
|
263
|
-
|
264
|
-
*Rafael Mendonça França*
|
265
|
-
|
266
|
-
* Seed database with inline ActiveJob job adapter.
|
279
|
+
*Kevin Jalbert*, *Gannon McGibbon*
|
267
280
|
|
268
|
-
|
281
|
+
* Cache compiled view templates when running tests by default.
|
269
282
|
|
270
|
-
|
283
|
+
When generating a new app without `--skip-spring`, caching classes is
|
284
|
+
disabled in `environments/test.rb`. This implicitly disables caching
|
285
|
+
view templates too. This change will enable view template caching by
|
286
|
+
adding this to the generated `environments/test.rb`:
|
271
287
|
|
288
|
+
```ruby
|
289
|
+
config.action_view.cache_template_loading = true
|
272
290
|
```
|
273
|
-
bin/rails db:system:change --to=postgresql
|
274
|
-
force config/database.yml
|
275
|
-
gsub Gemfile
|
276
|
-
```
|
277
|
-
|
278
|
-
The change command copies a template `config/database.yml` with
|
279
|
-
the target database adapter into your app, and replaces your database gem
|
280
|
-
with the target database gem.
|
281
|
-
|
282
|
-
*Gannon McGibbon*
|
283
|
-
|
284
|
-
* Add `rails test:channels`.
|
285
|
-
|
286
|
-
*bogdanvlviv*
|
287
|
-
|
288
|
-
* Use original `bundler` environment variables during the process of generating a new rails project.
|
289
|
-
|
290
|
-
*Marco Costa*
|
291
291
|
|
292
|
-
*
|
293
|
-
|
294
|
-
Analysis jobs now use the `:active_storage_analysis` queue, and purge jobs
|
295
|
-
now use the `:active_storage_purge` queue. This matches Action Mailbox,
|
296
|
-
which sends its jobs to dedicated queues by default.
|
297
|
-
|
298
|
-
*George Claghorn*
|
299
|
-
|
300
|
-
* Add `rails test:mailboxes`.
|
301
|
-
|
302
|
-
*George Claghorn*
|
303
|
-
|
304
|
-
* Introduce guard against DNS rebinding attacks.
|
305
|
-
|
306
|
-
The `ActionDispatch::HostAuthorization` is a new middleware that prevents
|
307
|
-
against DNS rebinding and other `Host` header attacks. It is included in
|
308
|
-
the development environment by default with the following configuration:
|
309
|
-
|
310
|
-
Rails.application.config.hosts = [
|
311
|
-
IPAddr.new("0.0.0.0/0"), # All IPv4 addresses.
|
312
|
-
IPAddr.new("::/0"), # All IPv6 addresses.
|
313
|
-
"localhost" # The localhost reserved domain.
|
314
|
-
]
|
315
|
-
|
316
|
-
In other environments `Rails.application.config.hosts` is empty and no
|
317
|
-
`Host` header checks will be done. If you want to guard against header
|
318
|
-
attacks on production, you have to manually permit the allowed hosts
|
319
|
-
with:
|
292
|
+
*Jorge Manrubia*
|
320
293
|
|
321
|
-
|
294
|
+
* Introduce middleware move operations.
|
322
295
|
|
323
|
-
|
324
|
-
|
325
|
-
`Proc` and `IPAddr` to name a few. Here is an example with a regexp.
|
296
|
+
With this change, you no longer need to delete and reinsert a middleware to
|
297
|
+
move it from one place to another in the stack:
|
326
298
|
|
327
|
-
|
328
|
-
|
329
|
-
|
299
|
+
```ruby
|
300
|
+
config.middleware.move_before ActionDispatch::Flash, Magical::Unicorns
|
301
|
+
```
|
330
302
|
|
331
|
-
|
303
|
+
This will move the `Magical::Unicorns` middleware before
|
304
|
+
`ActionDispatch::Flash`. You can also move it after with:
|
332
305
|
|
333
|
-
|
334
|
-
|
335
|
-
|
306
|
+
```ruby
|
307
|
+
config.middleware.move_after ActionDispatch::Flash, Magical::Unicorns
|
308
|
+
```
|
336
309
|
|
337
310
|
*Genadi Samokovarov*
|
338
311
|
|
339
|
-
*
|
340
|
-
|
341
|
-
*Gannon McGibbon*
|
342
|
-
|
343
|
-
* Remove redundant suffixes on generated integration tests.
|
344
|
-
|
345
|
-
*Gannon McGibbon*
|
346
|
-
|
347
|
-
* Fix boolean interaction in scaffold system tests.
|
348
|
-
|
349
|
-
*Gannon McGibbon*
|
350
|
-
|
351
|
-
* Remove redundant suffixes on generated system tests.
|
352
|
-
|
353
|
-
*Gannon McGibbon*
|
312
|
+
* Generators that inherit from NamedBase respect `--force` option.
|
354
313
|
|
355
|
-
*
|
356
|
-
out (`generate`, `rake`, `rails_command`) to abort the generator if the
|
357
|
-
command fails.
|
358
|
-
|
359
|
-
*David Rodríguez*
|
360
|
-
|
361
|
-
* Remove `app/assets` and `app/javascript` from `eager_load_paths` and `autoload_paths`.
|
362
|
-
|
363
|
-
*Gannon McGibbon*
|
364
|
-
|
365
|
-
* Use Ids instead of memory addresses when displaying references in scaffold views.
|
366
|
-
|
367
|
-
Fixes #29200.
|
314
|
+
*Josh Brody*
|
368
315
|
|
369
|
-
|
316
|
+
* Allow configuration of eager_load behaviour for rake environment:
|
370
317
|
|
371
|
-
|
372
|
-
Subtasks are also added to get the status of individual databases (eg. `rails db:migrate:status:animals`).
|
318
|
+
config.rake_eager_load
|
373
319
|
|
374
|
-
|
320
|
+
Defaults to `false` as per previous behaviour.
|
375
321
|
|
376
|
-
*
|
377
|
-
Sprockets is now solely in charge, by default, of compiling CSS and other static assets.
|
378
|
-
Action Cable channel generators will create ES6 stubs rather than use CoffeeScript.
|
379
|
-
Active Storage, Action Cable, Turbolinks, and Rails-UJS are loaded by a new application.js pack.
|
380
|
-
Generators no longer generate JavaScript stubs.
|
322
|
+
*Thierry Joyal*
|
381
323
|
|
382
|
-
|
324
|
+
* Ensure Rails migration generator respects system-wide primary key config.
|
383
325
|
|
384
|
-
|
385
|
-
setting the database. This is useful for applications that use
|
386
|
-
multiple databases and put migrations per database in their own directories.
|
326
|
+
When rails is configured to use a specific primary key type:
|
387
327
|
|
328
|
+
```ruby
|
329
|
+
config.generators do |g|
|
330
|
+
g.orm :active_record, primary_key_type: :uuid
|
331
|
+
end
|
388
332
|
```
|
389
|
-
bin/rails g model Room capacity:integer --database=kingston
|
390
|
-
invoke active_record
|
391
|
-
create db/kingston_migrate/20180830151055_create_rooms.rb
|
392
|
-
```
|
393
|
-
|
394
|
-
Because rails scaffolding uses the model generator, you can
|
395
|
-
also specify a database with the scaffold generator.
|
396
|
-
|
397
|
-
*Gannon McGibbon*
|
398
|
-
|
399
|
-
* Raise an error when "recyclable cache keys" are being used by a cache store
|
400
|
-
that does not explicitly support it. Custom cache keys that do support this feature
|
401
|
-
can bypass this error by implementing the `supports_cache_versioning?` method on their
|
402
|
-
class and returning a truthy value.
|
403
|
-
|
404
|
-
*Richard Schneeman*
|
405
|
-
|
406
|
-
* Support environment specific credentials overrides.
|
407
|
-
|
408
|
-
So any environment will look for `config/credentials/#{Rails.env}.yml.enc` and fall back
|
409
|
-
to `config/credentials.yml.enc`.
|
410
|
-
|
411
|
-
The encryption key can be in `ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key`.
|
412
|
-
|
413
|
-
Environment credentials overrides can be edited with `rails credentials:edit --environment production`.
|
414
|
-
If no override is set up for the passed environment, it will be created.
|
415
|
-
|
416
|
-
Additionally, the default lookup paths can be overwritten with these configs:
|
417
|
-
|
418
|
-
- `config.credentials.content_path`
|
419
|
-
- `config.credentials.key_path`
|
420
333
|
|
421
|
-
|
422
|
-
|
423
|
-
* Make `ActiveSupport::Cache::NullStore` the default cache store in the test environment.
|
424
|
-
|
425
|
-
*Michael C. Nelson*
|
426
|
-
|
427
|
-
* Emit warning for unknown inflection rule when generating model.
|
428
|
-
|
429
|
-
*Yoshiyuki Kinjo*
|
430
|
-
|
431
|
-
* Add `database` (aliased as `db`) option to migration generator.
|
432
|
-
|
433
|
-
If you're using multiple databases and have a folder for each database
|
434
|
-
for migrations (ex db/migrate and db/new_db_migrate) you can now pass the
|
435
|
-
`--database` option to the generator to make sure the the migration
|
436
|
-
is inserted into the correct folder.
|
334
|
+
Previously:
|
437
335
|
|
336
|
+
```bash
|
337
|
+
$ bin/rails g migration add_location_to_users location:references
|
438
338
|
```
|
439
|
-
rails g migration CreateHouses --database=kingston
|
440
|
-
invoke active_record
|
441
|
-
create db/kingston_migrate/20180830151055_create_houses.rb
|
442
|
-
```
|
443
|
-
|
444
|
-
*Eileen M. Uchitelle*
|
445
|
-
|
446
|
-
* Deprecate `rake routes` in favor of `rails routes`.
|
447
|
-
|
448
|
-
*Yuji Yaginuma*
|
449
|
-
|
450
|
-
* Deprecate `rake initializers` in favor of `rails initializers`.
|
451
|
-
|
452
|
-
*Annie-Claude Côté*
|
453
|
-
|
454
|
-
* Deprecate `rake dev:cache` in favor of `rails dev:cache`.
|
455
|
-
|
456
|
-
*Annie-Claude Côté*
|
457
|
-
|
458
|
-
* Deprecate `rails notes` subcommands in favor of passing an `annotations` argument to `rails notes`.
|
459
|
-
|
460
|
-
The following subcommands are replaced by passing `--annotations` or `-a` to `rails notes`:
|
461
|
-
- `rails notes:custom ANNOTATION=custom` is deprecated in favor of using `rails notes -a custom`.
|
462
|
-
- `rails notes:optimize` is deprecated in favor of using `rails notes -a OPTIMIZE`.
|
463
|
-
- `rails notes:todo` is deprecated in favor of using`rails notes -a TODO`.
|
464
|
-
- `rails notes:fixme` is deprecated in favor of using `rails notes -a FIXME`.
|
465
339
|
|
466
|
-
|
340
|
+
The references line in the migration would not have `type: :uuid`.
|
341
|
+
This change causes the type to be applied appropriately.
|
467
342
|
|
468
|
-
*
|
469
|
-
through `Rails::SourceAnnotationExtractor::Annotation` in favor of using `config.annotations.register_directories`.
|
343
|
+
*Louis-Michel Couture*, *Dermot Haughey*
|
470
344
|
|
471
|
-
|
345
|
+
* Deprecate `Rails::DBConsole#config`.
|
472
346
|
|
473
|
-
|
347
|
+
`Rails::DBConsole#config` is deprecated without replacement. Use `Rails::DBConsole.db_config.configuration_hash` instead.
|
474
348
|
|
475
|
-
*
|
349
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
476
350
|
|
477
|
-
*
|
351
|
+
* `Rails.application.config_for` merges shared configuration deeply.
|
478
352
|
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
Previously:
|
491
|
-
|
492
|
-
$ ls -l config/master.key
|
493
|
-
-rw-r--r-- 1 owner group 32 Jan 1 00:00 master.key
|
494
|
-
|
495
|
-
Now:
|
353
|
+
```yaml
|
354
|
+
# config/example.yml
|
355
|
+
shared:
|
356
|
+
foo:
|
357
|
+
bar:
|
358
|
+
baz: 1
|
359
|
+
development:
|
360
|
+
foo:
|
361
|
+
bar:
|
362
|
+
qux: 2
|
363
|
+
```
|
496
364
|
|
497
|
-
|
498
|
-
|
365
|
+
```ruby
|
366
|
+
# Previously
|
367
|
+
Rails.application.config_for(:example)[:foo][:bar] #=> { qux: 2 }
|
499
368
|
|
500
|
-
|
369
|
+
# Now
|
370
|
+
Rails.application.config_for(:example)[:foo][:bar] #=> { baz: 1, qux: 2 }
|
371
|
+
```
|
501
372
|
|
502
|
-
*
|
373
|
+
*Yuhei Kiriyama*
|
503
374
|
|
504
|
-
*
|
375
|
+
* Remove access to values in nested hashes returned by `Rails.application.config_for` via String keys.
|
505
376
|
|
506
|
-
|
377
|
+
```yaml
|
378
|
+
# config/example.yml
|
379
|
+
development:
|
380
|
+
options:
|
381
|
+
key: value
|
382
|
+
```
|
507
383
|
|
508
|
-
|
384
|
+
```ruby
|
385
|
+
Rails.application.config_for(:example).options
|
386
|
+
```
|
509
387
|
|
510
|
-
|
388
|
+
This used to return a Hash on which you could access values with String keys. This was deprecated in 6.0, and now doesn't work anymore.
|
511
389
|
|
512
|
-
|
390
|
+
*Étienne Barrié*
|
513
391
|
|
514
|
-
|
392
|
+
* Configuration files for environments (`config/environments/*.rb`) are
|
393
|
+
now able to modify `autoload_paths`, `autoload_once_paths`, and
|
394
|
+
`eager_load_paths`.
|
515
395
|
|
516
|
-
|
396
|
+
As a consequence, applications cannot autoload within those files. Before, they technically could, but changes in autoloaded classes or modules had no effect anyway in the configuration because reloading does not reboot.
|
517
397
|
|
518
|
-
|
519
|
-
`--using` option with the `-u` short switch.
|
398
|
+
Ways to use application code in these files:
|
520
399
|
|
521
|
-
|
400
|
+
* Define early in the boot process a class that is not reloadable, from which the application takes configuration values that get passed to the framework.
|
522
401
|
|
523
|
-
|
402
|
+
```ruby
|
403
|
+
# In config/application.rb, for example.
|
404
|
+
require "#{Rails.root}/lib/my_app/config"
|
524
405
|
|
525
|
-
|
526
|
-
|
406
|
+
# In config/environments/development.rb, for example.
|
407
|
+
config.foo = MyApp::Config.foo
|
408
|
+
```
|
527
409
|
|
528
|
-
*
|
410
|
+
* If the class has to be reloadable, then wrap the configuration code in a `to_prepare` block:
|
529
411
|
|
530
|
-
|
531
|
-
|
412
|
+
```ruby
|
413
|
+
config.to_prepare do
|
414
|
+
config.foo = MyModel.foo
|
415
|
+
end
|
416
|
+
```
|
532
417
|
|
533
|
-
|
534
|
-
$ rails routes --expanded
|
535
|
-
--[ Route 1 ]------------------------------------------------------------
|
536
|
-
Prefix | high_scores
|
537
|
-
Verb | GET
|
538
|
-
URI | /high_scores(.:format)
|
539
|
-
Controller#Action | high_scores#index
|
540
|
-
--[ Route 2 ]------------------------------------------------------------
|
541
|
-
Prefix | new_high_score
|
542
|
-
Verb | GET
|
543
|
-
URI | /high_scores/new(.:format)
|
544
|
-
Controller#Action | high_scores#new
|
545
|
-
```
|
418
|
+
That assigns the latest `MyModel.foo` to `config.foo` when the application boots, and each time there is a reload. But whether that has an effect or not depends on the configuration point, since it is not uncommon for engines to read the application configuration during initialization and set their own state from them. That process happens only on boot, not on reloads, and if that is how `config.foo` worked, resetting it would have no effect in the state of the engine.
|
546
419
|
|
547
|
-
*
|
420
|
+
*Allen Hsu* & *Xavier Noria*
|
548
421
|
|
549
|
-
*
|
422
|
+
* Support using environment variable to set pidfile.
|
550
423
|
|
551
|
-
*
|
424
|
+
*Ben Thorner*
|
552
425
|
|
553
426
|
|
554
|
-
Please check [
|
427
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/railties/CHANGELOG.md) for previous changes.
|