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