railties 6.1.4 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +119 -330
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.rdoc +16 -16
- data/README.rdoc +0 -1
- data/lib/rails/all.rb +0 -1
- data/lib/rails/app_updater.rb +3 -5
- data/lib/rails/application/bootstrap.rb +21 -5
- data/lib/rails/application/configuration.rb +72 -30
- data/lib/rails/application/default_middleware_stack.rb +7 -3
- data/lib/rails/application/finisher.rb +42 -85
- data/lib/rails/application/routes_reloader.rb +8 -0
- data/lib/rails/application.rb +24 -50
- data/lib/rails/application_controller.rb +2 -2
- data/lib/rails/autoloaders/inflector.rb +21 -0
- data/lib/rails/autoloaders.rb +12 -16
- data/lib/rails/code_statistics.rb +2 -2
- data/lib/rails/code_statistics_calculator.rb +10 -1
- data/lib/rails/command/base.rb +26 -12
- data/lib/rails/command/behavior.rb +1 -1
- data/lib/rails/command/environment_argument.rb +1 -1
- data/lib/rails/command.rb +8 -5
- data/lib/rails/commands/credentials/USAGE +4 -2
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +26 -16
- data/lib/rails/commands/credentials/credentials_command.rb +8 -3
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +10 -11
- data/lib/rails/commands/help/USAGE +3 -2
- data/lib/rails/commands/runner/runner_command.rb +3 -2
- data/lib/rails/commands/server/server_command.rb +2 -5
- data/lib/rails/configuration.rb +18 -23
- data/lib/rails/engine/configuration.rb +3 -3
- data/lib/rails/engine.rb +18 -24
- data/lib/rails/gem_version.rb +3 -3
- data/lib/rails/generators/actions/create_migration.rb +2 -4
- data/lib/rails/generators/actions.rb +35 -13
- data/lib/rails/generators/app_base.rb +133 -109
- data/lib/rails/generators/app_name.rb +1 -1
- data/lib/rails/generators/base.rb +9 -13
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -0
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +8 -8
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +8 -4
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +11 -28
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +7 -3
- data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +17 -0
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +8 -17
- data/lib/rails/generators/erb.rb +1 -1
- data/lib/rails/generators/generated_attribute.rb +45 -9
- data/lib/rails/generators/migration.rb +2 -6
- data/lib/rails/generators/model_helpers.rb +1 -1
- data/lib/rails/generators/named_base.rb +11 -11
- data/lib/rails/generators/rails/app/app_generator.rb +54 -91
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +42 -52
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +2 -2
- data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/app/models/application_record.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +3 -9
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +1 -4
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +0 -3
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +9 -14
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +0 -1
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +6 -12
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +11 -38
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +6 -11
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +1 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +19 -25
- data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +117 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +3 -3
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +4 -1
- data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +0 -5
- data/lib/rails/generators/rails/app/templates/gitignore.tt +3 -1
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +1 -1
- data/lib/rails/generators/rails/controller/controller_generator.rb +1 -2
- data/lib/rails/generators/rails/controller/templates/controller.rb.tt +0 -4
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +1 -1
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +42 -25
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +7 -3
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +11 -20
- data/lib/rails/generators/rails/plugin/templates/README.md.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +0 -3
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +4 -5
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -5
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +2 -7
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +0 -19
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -5
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +6 -10
- data/lib/rails/generators/resource_helpers.rb +2 -2
- data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +3 -3
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +5 -5
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +7 -7
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +9 -11
- data/lib/rails/generators/testing/behaviour.rb +3 -4
- data/lib/rails/generators.rb +9 -22
- data/lib/rails/info.rb +1 -1
- data/lib/rails/info_controller.rb +1 -3
- data/lib/rails/initializable.rb +1 -1
- data/lib/rails/mailers_controller.rb +2 -4
- data/lib/rails/rack/logger.rb +0 -1
- data/lib/rails/railtie/configuration.rb +1 -2
- data/lib/rails/railtie.rb +27 -10
- data/lib/rails/ruby_version_check.rb +3 -3
- data/lib/rails/secrets.rb +4 -1
- data/lib/rails/tasks/framework.rake +2 -8
- data/lib/rails/tasks/statistics.rake +3 -1
- data/lib/rails/tasks/tmp.rake +8 -1
- data/lib/rails/tasks/yarn.rake +8 -9
- data/lib/rails/tasks/zeitwerk.rake +2 -10
- data/lib/rails/templates/layouts/application.html.erb +15 -0
- data/lib/rails/templates/rails/mailers/email.html.erb +13 -11
- data/lib/rails/templates/rails/welcome/index.html.erb +62 -47
- data/lib/rails/test_unit/railtie.rb +0 -4
- data/lib/rails/test_unit/runner.rb +16 -9
- data/lib/rails/test_unit/testing.rake +4 -9
- data/lib/rails/welcome_controller.rb +1 -0
- data/lib/rails.rb +5 -0
- metadata +33 -36
- data/lib/rails/command/spellchecker.rb +0 -57
- data/lib/rails/generators/css/assets/assets_generator.rb +0 -15
- data/lib/rails/generators/css/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/css/scaffold/scaffold_generator.rb +0 -18
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +0 -6
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +0 -5
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +0 -23
- data/lib/rails/generators/rails/app/templates/bin/spring.tt +0 -13
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +0 -16
- data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt +0 -8
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +0 -8
- data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb.tt +0 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb.tt +0 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +0 -67
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +0 -16
- data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +0 -6
- data/lib/rails/generators/rails/app/templates/package.json.tt +0 -11
- data/lib/rails/generators/rails/assets/USAGE +0 -16
- data/lib/rails/generators/rails/assets/assets_generator.rb +0 -26
- data/lib/rails/generators/rails/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +0 -80
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5cb58ddc9e6fbbf28a0fb9c625cecec9cd282d59ccd697cf37cd1f78f7d25811
|
|
4
|
+
data.tar.gz: b6304f9dfa982671da582fb01c63f310b76d3d043aca2826ff5c54acecc7f90c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: febb1c2b1fc87226219dc2cf5870c236b801624c9a4d8c62b0853a1e3e033fbfec76e5b418de34774e069aa0b60d8b2c687c68ab729cc7165806974f16373b40
|
|
7
|
+
data.tar.gz: a6305f03e1ed58b3afd6a9647b6fb43a48007c08370db1e066c15e135ce159c9adc7ac84c318033264e1c18cafdf2d9446d3e08341e4922c46fb7c7b83a81ff7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,427 +1,216 @@
|
|
|
1
|
-
## Rails
|
|
2
|
-
|
|
3
|
-
* Fix compatibility with `psych >= 4`.
|
|
4
|
-
|
|
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.
|
|
7
|
-
|
|
8
|
-
*Jean Boussier*
|
|
9
|
-
|
|
10
|
-
* Ensure `Rails.application.config_for` always cast hashes to `ActiveSupport::OrderedOptions`.
|
|
11
|
-
|
|
12
|
-
*Jean Boussier*
|
|
13
|
-
|
|
14
|
-
* Fix create migration generator with `--pretend` option.
|
|
15
|
-
|
|
16
|
-
*euxx*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Rails 6.1.3.2 (May 05, 2021) ##
|
|
1
|
+
## Rails 7.0.0 (December 15, 2021) ##
|
|
20
2
|
|
|
21
3
|
* No changes.
|
|
22
4
|
|
|
23
5
|
|
|
24
|
-
## Rails
|
|
25
|
-
|
|
26
|
-
* No changes.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## Rails 6.1.3 (February 17, 2021) ##
|
|
30
|
-
|
|
31
|
-
* No changes.
|
|
6
|
+
## Rails 7.0.0.rc3 (December 14, 2021) ##
|
|
32
7
|
|
|
8
|
+
* Allow localhost with a port by default in development
|
|
33
9
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* No changes.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Rails 6.1.2 (February 09, 2021) ##
|
|
40
|
-
|
|
41
|
-
* No changes.
|
|
10
|
+
[Fixes: #43864]
|
|
42
11
|
|
|
12
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
|
43
13
|
|
|
44
|
-
|
|
14
|
+
* No changes
|
|
45
15
|
|
|
46
|
-
|
|
16
|
+
## Rails 7.0.0.rc1 (December 06, 2021) ##
|
|
47
17
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* Populate ARGV for app template.
|
|
51
|
-
|
|
52
|
-
Fixes #40945.
|
|
53
|
-
|
|
54
|
-
*Jonathan Hefner*
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## Rails 6.1.0 (December 09, 2020) ##
|
|
58
|
-
|
|
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.
|
|
63
|
-
|
|
64
|
-
It can be used like this:
|
|
65
|
-
|
|
66
|
-
```ruby
|
|
67
|
-
class MyRailtie < Rails::Railtie
|
|
68
|
-
server do
|
|
69
|
-
WebpackServer.run
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
*Edouard Chin*
|
|
75
|
-
|
|
76
|
-
* Remove deprecated `rake dev:cache` tasks.
|
|
77
|
-
|
|
78
|
-
*Rafael Mendonça França*
|
|
79
|
-
|
|
80
|
-
* Remove deprecated `rake routes` tasks.
|
|
18
|
+
* Remove deprecated `config` in `dbconsole`.
|
|
81
19
|
|
|
82
20
|
*Rafael Mendonça França*
|
|
83
21
|
|
|
84
|
-
*
|
|
22
|
+
* Change default `X-XSS-Protection` header to disable XSS auditor
|
|
85
23
|
|
|
86
|
-
|
|
24
|
+
This header has been deprecated and the XSS auditor it triggered
|
|
25
|
+
has been removed from all major modern browsers (in favour of
|
|
26
|
+
Content Security Policy) that implemented this header to begin with
|
|
27
|
+
(Firefox never did).
|
|
87
28
|
|
|
88
|
-
|
|
29
|
+
[OWASP](https://owasp.org/www-project-secure-headers/#x-xss-protection)
|
|
30
|
+
suggests setting this header to '0' to disable the default behaviour
|
|
31
|
+
on old browsers as it can introduce additional security issues.
|
|
89
32
|
|
|
90
|
-
|
|
33
|
+
Added the new behaviour as a framework default from Rails 7.0.
|
|
91
34
|
|
|
92
|
-
*
|
|
35
|
+
*Christian Sutter*
|
|
93
36
|
|
|
94
|
-
|
|
37
|
+
* Scaffolds now use date_field, time_field and datetime_field instead of
|
|
38
|
+
date_select, time_select and datetime_select; thus providing native date/time pickers.
|
|
95
39
|
|
|
96
|
-
*
|
|
40
|
+
*Martijn Lafeber*
|
|
97
41
|
|
|
98
|
-
|
|
42
|
+
* Fix a regression in which autoload paths were initialized too late.
|
|
99
43
|
|
|
100
|
-
*
|
|
44
|
+
*Xavier Noria*
|
|
101
45
|
|
|
102
|
-
|
|
46
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
|
103
47
|
|
|
104
|
-
*
|
|
48
|
+
* Fix activestorage dependency in the npm package.
|
|
105
49
|
|
|
106
50
|
*Rafael Mendonça França*
|
|
107
51
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Fixes #38998.
|
|
111
|
-
|
|
112
|
-
*Loren Norman*
|
|
113
|
-
|
|
114
|
-
* Make railsrc file location xdg-specification compliant
|
|
115
|
-
|
|
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`.
|
|
120
|
-
|
|
121
|
-
The fallback behaviour means this does not cause any breaking changes.
|
|
122
|
-
|
|
123
|
-
*Nick Wolf*
|
|
52
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
|
124
53
|
|
|
125
|
-
*
|
|
126
|
-
|
|
54
|
+
* New and upgraded Rails apps no longer generate `config/initializers/application_controller_renderer.rb`
|
|
55
|
+
or `config/initializers/cookies_serializer.rb`
|
|
127
56
|
|
|
128
|
-
|
|
57
|
+
The default value for `cookies_serializer` (`:json`) has been moved to `config.load_defaults("7.0")`.
|
|
58
|
+
The new framework defaults file can be used to upgrade the serializer.
|
|
129
59
|
|
|
130
|
-
*
|
|
60
|
+
*Alex Ghiculescu*
|
|
131
61
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
Usage:
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
$ bin/rails generate scaffold Pet name:string --database=animals
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Will create an abstract class for the animals connection.
|
|
141
|
-
|
|
142
|
-
```ruby
|
|
143
|
-
class AnimalsRecord < ApplicationRecord
|
|
144
|
-
self.abstract_class = true
|
|
145
|
-
|
|
146
|
-
connects_to database: { writing: :animals }
|
|
147
|
-
end
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
And generate a `Pet` model that inherits from the new `AnimalsRecord`:
|
|
151
|
-
|
|
152
|
-
```ruby
|
|
153
|
-
class Pet < AnimalsRecord
|
|
154
|
-
end
|
|
155
|
-
```
|
|
156
|
-
|
|
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.
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
$ bin/rails generate scaffold Pet name:string --database=animals --parent=SecondaryBase
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
This will ensure the model inherits from the `SecondaryBase` parent instead of `AnimalsRecord`
|
|
164
|
-
|
|
165
|
-
```ruby
|
|
166
|
-
class Pet < SecondaryBase
|
|
167
|
-
end
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
*Eileen M. Uchitelle*, *John Crepezzi*
|
|
171
|
-
|
|
172
|
-
* Accept params from url to prepopulate the Inbound Emails form in Rails conductor.
|
|
173
|
-
|
|
174
|
-
*Chris Oliver*
|
|
175
|
-
|
|
176
|
-
* Create a new rails app using a minimal stack.
|
|
177
|
-
|
|
178
|
-
`rails new cool_app --minimal`
|
|
179
|
-
|
|
180
|
-
All the following are excluded from your minimal stack:
|
|
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
|
|
194
|
-
|
|
195
|
-
*Haroon Ahmed*, *DHH*
|
|
196
|
-
|
|
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.
|
|
199
|
-
|
|
200
|
-
`BACKTRACE=1 ./bin/rails runner "MyClass.perform"`
|
|
201
|
-
|
|
202
|
-
*DHH*
|
|
203
|
-
|
|
204
|
-
* The autoloading guide for Zeitwerk mode documents how to autoload classes
|
|
205
|
-
during application boot in a safe way.
|
|
206
|
-
|
|
207
|
-
*Haroon Ahmed*, *Xavier Noria*
|
|
208
|
-
|
|
209
|
-
* The `classic` autoloader starts its deprecation cycle.
|
|
210
|
-
|
|
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.
|
|
62
|
+
* New applications get a dependency on the new `debug` gem, replacing `byebug`.
|
|
212
63
|
|
|
213
64
|
*Xavier Noria*
|
|
214
65
|
|
|
215
|
-
*
|
|
66
|
+
* Add SSL support for postgresql in `bin/rails dbconsole`.
|
|
216
67
|
|
|
217
|
-
|
|
68
|
+
Fixes #43114.
|
|
218
69
|
|
|
219
|
-
*
|
|
70
|
+
*Michael Bayucot*
|
|
220
71
|
|
|
221
|
-
* Add
|
|
72
|
+
* Add support for comments above gem declaration in Rails application templates, e.g. `gem("nokogiri", comment: "For XML")`.
|
|
222
73
|
|
|
223
|
-
|
|
74
|
+
*Linas Juškevičius*
|
|
224
75
|
|
|
225
|
-
|
|
76
|
+
* The setter `config.autoloader=` has been deleted. `zeitwerk` is the only
|
|
77
|
+
available autoloading mode.
|
|
226
78
|
|
|
227
|
-
*
|
|
228
|
-
|
|
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.
|
|
232
|
-
|
|
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).
|
|
236
|
-
|
|
237
|
-
*Jorge Manrubia*
|
|
238
|
-
|
|
239
|
-
* No longer include `rake rdoc` task when generating plugins.
|
|
240
|
-
|
|
241
|
-
To generate docs, use the `rdoc lib` command instead.
|
|
242
|
-
|
|
243
|
-
*Jonathan Hefner*
|
|
244
|
-
|
|
245
|
-
* Allow relative paths with trailing slashes to be passed to `rails test`.
|
|
246
|
-
|
|
247
|
-
*Eugene Kenny*
|
|
248
|
-
|
|
249
|
-
* Add `rack-mini-profiler` gem to the default `Gemfile`.
|
|
250
|
-
|
|
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.
|
|
254
|
-
|
|
255
|
-
*Osama Sayegh*
|
|
256
|
-
|
|
257
|
-
* `rails stats` will now count TypeScript files toward JavaScript stats.
|
|
258
|
-
|
|
259
|
-
*Joshua Cody*
|
|
260
|
-
|
|
261
|
-
* Run `git init` when generating plugins.
|
|
79
|
+
*Xavier Noria*
|
|
262
80
|
|
|
263
|
-
|
|
81
|
+
* `config.autoload_once_paths` can be configured in the body of the
|
|
82
|
+
application class defined in `config/application.rb` or in the configuration
|
|
83
|
+
for environments in `config/environments/*`.
|
|
264
84
|
|
|
265
|
-
|
|
85
|
+
Similarly, engines can configure that collection in the class body of the
|
|
86
|
+
engine class or in the configuration for environments.
|
|
266
87
|
|
|
267
|
-
|
|
88
|
+
After that, the collection is frozen, and you can autoload from those paths.
|
|
89
|
+
They are managed by the `Rails.autoloaders.once` autoloader, which does not
|
|
90
|
+
reload, only autoloads/eager loads.
|
|
268
91
|
|
|
269
|
-
|
|
92
|
+
*Xavier Noria*
|
|
270
93
|
|
|
271
|
-
|
|
94
|
+
* During initialization, you cannot autoload reloadable classes or modules
|
|
95
|
+
like application models, unless they are wrapped in a `to_prepare` block.
|
|
96
|
+
For example, from `config/initializers/*`, or in application, engines, or
|
|
97
|
+
railties initializers.
|
|
272
98
|
|
|
273
|
-
|
|
274
|
-
|
|
99
|
+
Please check the [autoloading
|
|
100
|
+
guide](https://guides.rubyonrails.org/v7.0/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots)
|
|
101
|
+
for details.
|
|
275
102
|
|
|
276
|
-
|
|
277
|
-
`ruby script/benchmarks/opt_compare.rb`
|
|
103
|
+
*Xavier Noria*
|
|
278
104
|
|
|
279
|
-
|
|
105
|
+
* While they are allowed to have elements in common, it is no longer required
|
|
106
|
+
that `config.autoload_once_paths` is a subset of `config.autoload_paths`.
|
|
107
|
+
The former are managed by the `once` autoloader. The `main` autoloader
|
|
108
|
+
manages the latter minus the former.
|
|
280
109
|
|
|
281
|
-
*
|
|
110
|
+
*Xavier Noria*
|
|
282
111
|
|
|
283
|
-
|
|
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`:
|
|
112
|
+
* Show Rake task description if command is run with `-h`.
|
|
287
113
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
```
|
|
114
|
+
Adding `-h` (or `--help`) to a Rails command that's a Rake task now outputs
|
|
115
|
+
the task description instead of the general Rake help.
|
|
291
116
|
|
|
292
|
-
*
|
|
117
|
+
*Petrik de Heus*
|
|
293
118
|
|
|
294
|
-
*
|
|
119
|
+
* Add missing `plugin new` command to help.
|
|
295
120
|
|
|
296
|
-
|
|
297
|
-
move it from one place to another in the stack:
|
|
121
|
+
*Petrik de Heus
|
|
298
122
|
|
|
299
|
-
|
|
300
|
-
config.middleware.move_before ActionDispatch::Flash, Magical::Unicorns
|
|
301
|
-
```
|
|
123
|
+
* Fix `config_for` error when there's only a shared root array.
|
|
302
124
|
|
|
303
|
-
|
|
304
|
-
`ActionDispatch::Flash`. You can also move it after with:
|
|
125
|
+
*Loïc Delmaire*
|
|
305
126
|
|
|
306
|
-
|
|
307
|
-
config.middleware.move_after ActionDispatch::Flash, Magical::Unicorns
|
|
308
|
-
```
|
|
127
|
+
* Raise an error in generators if an index type is invalid.
|
|
309
128
|
|
|
310
|
-
*
|
|
129
|
+
*Petrik de Heus*
|
|
311
130
|
|
|
312
|
-
*
|
|
131
|
+
* `package.json` now uses a strict version constraint for Rails JavaScript packages on new Rails apps.
|
|
313
132
|
|
|
314
|
-
*
|
|
133
|
+
*Zachary Scott*, *Alex Ghiculescu*
|
|
315
134
|
|
|
316
|
-
*
|
|
135
|
+
* Modified scaffold generator template so that running
|
|
136
|
+
`rails g scaffold Author` no longer generates tests called "creating
|
|
137
|
+
a Author", "updating a Author", and "destroying a Author".
|
|
317
138
|
|
|
318
|
-
|
|
139
|
+
Fixes #40744.
|
|
319
140
|
|
|
320
|
-
|
|
141
|
+
*Michael Duchemin*
|
|
321
142
|
|
|
322
|
-
|
|
143
|
+
* Raise an error in generators if a field type is invalid.
|
|
323
144
|
|
|
324
|
-
*
|
|
145
|
+
*Petrik de Heus*
|
|
325
146
|
|
|
326
|
-
|
|
147
|
+
* `bin/rails tmp:clear` deletes also files and directories in `tmp/storage`.
|
|
327
148
|
|
|
328
|
-
|
|
329
|
-
config.generators do |g|
|
|
330
|
-
g.orm :active_record, primary_key_type: :uuid
|
|
331
|
-
end
|
|
332
|
-
```
|
|
149
|
+
*George Claghorn*
|
|
333
150
|
|
|
334
|
-
|
|
151
|
+
* Fix compatibility with `psych >= 4`.
|
|
335
152
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
```
|
|
153
|
+
Starting in Psych 4.0.0 `YAML.load` behaves like `YAML.safe_load`. To preserve compatibility
|
|
154
|
+
`Rails.application.config_for` now uses `YAML.unsafe_load` if available.
|
|
339
155
|
|
|
340
|
-
|
|
341
|
-
This change causes the type to be applied appropriately.
|
|
156
|
+
*Jean Boussier*
|
|
342
157
|
|
|
343
|
-
|
|
158
|
+
* Allow loading nested locales in engines.
|
|
344
159
|
|
|
345
|
-
*
|
|
160
|
+
*Gannon McGibbon*
|
|
346
161
|
|
|
347
|
-
|
|
162
|
+
* Ensure `Rails.application.config_for` always cast hashes to `ActiveSupport::OrderedOptions`.
|
|
348
163
|
|
|
349
|
-
*
|
|
164
|
+
*Jean Boussier*
|
|
350
165
|
|
|
351
|
-
* `
|
|
166
|
+
* Remove `Rack::Runtime` from the default middleware stack and deprecate
|
|
167
|
+
referencing it in middleware operations without adding it back.
|
|
352
168
|
|
|
353
|
-
|
|
354
|
-
# config/example.yml
|
|
355
|
-
shared:
|
|
356
|
-
foo:
|
|
357
|
-
bar:
|
|
358
|
-
baz: 1
|
|
359
|
-
development:
|
|
360
|
-
foo:
|
|
361
|
-
bar:
|
|
362
|
-
qux: 2
|
|
363
|
-
```
|
|
169
|
+
*Hartley McGuire*
|
|
364
170
|
|
|
365
|
-
|
|
366
|
-
# Previously
|
|
367
|
-
Rails.application.config_for(:example)[:foo][:bar] #=> { qux: 2 }
|
|
171
|
+
* Allow adding additional authorized hosts in development via `ENV['RAILS_DEVELOPMENT_HOSTS']`.
|
|
368
172
|
|
|
369
|
-
|
|
370
|
-
Rails.application.config_for(:example)[:foo][:bar] #=> { baz: 1, qux: 2 }
|
|
371
|
-
```
|
|
173
|
+
*Josh Abernathy*, *Debbie Milburn*
|
|
372
174
|
|
|
373
|
-
|
|
175
|
+
* Add app concern and test keepfiles to generated engine plugins.
|
|
374
176
|
|
|
375
|
-
*
|
|
177
|
+
*Gannon McGibbon*
|
|
376
178
|
|
|
377
|
-
|
|
378
|
-
# config/example.yml
|
|
379
|
-
development:
|
|
380
|
-
options:
|
|
381
|
-
key: value
|
|
382
|
-
```
|
|
179
|
+
* Stop generating a license for in-app plugins.
|
|
383
180
|
|
|
384
|
-
|
|
385
|
-
Rails.application.config_for(:example).options
|
|
386
|
-
```
|
|
181
|
+
*Gannon McGibbon*
|
|
387
182
|
|
|
388
|
-
|
|
183
|
+
* `rails app:update` no longer prompts you to overwrite files that are generally modified in the
|
|
184
|
+
course of developing a Rails app. See [#41083](https://github.com/rails/rails/pull/41083) for
|
|
185
|
+
the full list of changes.
|
|
389
186
|
|
|
390
|
-
|
|
187
|
+
*Alex Ghiculescu*
|
|
391
188
|
|
|
392
|
-
*
|
|
393
|
-
now able to modify `autoload_paths`, `autoload_once_paths`, and
|
|
394
|
-
`eager_load_paths`.
|
|
189
|
+
* Change default branch for new Rails projects and plugins to `main`.
|
|
395
190
|
|
|
396
|
-
|
|
191
|
+
*Prateek Choudhary*
|
|
397
192
|
|
|
398
|
-
|
|
193
|
+
* The new method `Rails.benchmark` gives you a quick way to measure and log the execution time taken by a block:
|
|
399
194
|
|
|
400
|
-
|
|
195
|
+
def test_expensive_stuff
|
|
196
|
+
Rails.benchmark("test_expensive_stuff") { ... }
|
|
197
|
+
end
|
|
401
198
|
|
|
402
|
-
|
|
403
|
-
# In config/application.rb, for example.
|
|
404
|
-
require "#{Rails.root}/lib/my_app/config"
|
|
199
|
+
This functionality was available in some contexts only before.
|
|
405
200
|
|
|
406
|
-
|
|
407
|
-
config.foo = MyApp::Config.foo
|
|
408
|
-
```
|
|
201
|
+
*Simon Perepelitsa*
|
|
409
202
|
|
|
410
|
-
|
|
203
|
+
* Applications generated with `--skip-sprockets` no longer get `app/assets/config/manifest.js` and `app/assets/stylesheets/application.css`.
|
|
411
204
|
|
|
412
|
-
|
|
413
|
-
config.to_prepare do
|
|
414
|
-
config.foo = MyModel.foo
|
|
415
|
-
end
|
|
416
|
-
```
|
|
205
|
+
*Cindy Gao*
|
|
417
206
|
|
|
418
|
-
|
|
207
|
+
* Add support for stylesheets and ERB views to `rails stats`.
|
|
419
208
|
|
|
420
|
-
*
|
|
209
|
+
*Joel Hawksley*
|
|
421
210
|
|
|
422
|
-
*
|
|
211
|
+
* Allow appended root routes to take precedence over internal welcome controller.
|
|
423
212
|
|
|
424
|
-
*
|
|
213
|
+
*Gannon McGibbon*
|
|
425
214
|
|
|
426
215
|
|
|
427
|
-
Please check [6-
|
|
216
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/railties/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED
data/RDOC_MAIN.rdoc
CHANGED
|
@@ -15,21 +15,21 @@ application into three layers: Model, View, and Controller, each with a specific
|
|
|
15
15
|
The <em><b>Model layer</b></em> represents the domain model (such as Account, Product,
|
|
16
16
|
Person, Post, etc.) and encapsulates the business logic specific to
|
|
17
17
|
your application. In \Rails, database-backed model classes are derived from
|
|
18
|
-
<tt>ActiveRecord::Base</tt>. {Active Record}[link
|
|
18
|
+
<tt>ActiveRecord::Base</tt>. {Active Record}[link:/files/activerecord/README_rdoc.html] allows you to present the data from
|
|
19
19
|
database rows as objects and embellish these data objects with business logic
|
|
20
20
|
methods. Although most \Rails models are backed by a database, models can also be ordinary
|
|
21
21
|
Ruby classes, or Ruby classes that implement a set of interfaces as provided by
|
|
22
|
-
the {Active Model}[link
|
|
22
|
+
the {Active Model}[link:/files/activemodel/README_rdoc.html] module.
|
|
23
23
|
|
|
24
24
|
== Controller layer
|
|
25
25
|
|
|
26
26
|
The <em><b>Controller layer</b></em> is responsible for handling incoming HTTP requests and
|
|
27
|
-
providing a suitable response. Usually this means returning \HTML, but \Rails controllers
|
|
27
|
+
providing a suitable response. Usually, this means returning \HTML, but \Rails controllers
|
|
28
28
|
can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and
|
|
29
|
-
manipulate models
|
|
29
|
+
manipulate models and render view templates in order to generate the appropriate HTTP response.
|
|
30
30
|
In \Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and
|
|
31
31
|
controller classes are derived from <tt>ActionController::Base</tt>. Action Dispatch and Action Controller
|
|
32
|
-
are bundled together in {Action Pack}[link
|
|
32
|
+
are bundled together in {Action Pack}[link:/files/actionpack/README_rdoc.html].
|
|
33
33
|
|
|
34
34
|
== View layer
|
|
35
35
|
|
|
@@ -37,19 +37,19 @@ The <em><b>View layer</b></em> is composed of "templates" that are responsible f
|
|
|
37
37
|
appropriate representations of your application's resources. Templates can
|
|
38
38
|
come in a variety of formats, but most view templates are \HTML with embedded
|
|
39
39
|
Ruby code (ERB files). Views are typically rendered to generate a controller response,
|
|
40
|
-
or to generate the body of an email. In \Rails, View generation is handled by {Action View}[link
|
|
40
|
+
or to generate the body of an email. In \Rails, View generation is handled by {Action View}[link:/files/actionview/README_rdoc.html].
|
|
41
41
|
|
|
42
42
|
== Frameworks and libraries
|
|
43
43
|
|
|
44
|
-
{Active Record}[link
|
|
45
|
-
{Action Pack}[link
|
|
46
|
-
In addition to that, \Rails also comes with {Action Mailer}[link
|
|
47
|
-
to generate and send emails; {Action Mailbox}[link
|
|
48
|
-
{Active Job}[link
|
|
49
|
-
backends; {Action Cable}[link
|
|
50
|
-
integrate WebSockets with a \Rails application; {Active Storage}[link
|
|
51
|
-
a library to attach cloud and local files to \Rails applications; {Action Text}[link
|
|
52
|
-
and {Active Support}[link
|
|
44
|
+
{Active Record}[link:/files/activerecord/README_rdoc.html], {Active Model}[link:/files/activemodel/README_rdoc.html],
|
|
45
|
+
{Action Pack}[link:/files/actionpack/README_rdoc.html], and {Action View}[link:/files/actionview/README_rdoc.html] can each be used independently outside \Rails.
|
|
46
|
+
In addition to that, \Rails also comes with {Action Mailer}[link:/files/actionmailer/README_rdoc.html], a library
|
|
47
|
+
to generate and send emails; {Action Mailbox}[link:/files/actionmailbox/README_md.html], a library to receive emails within a Rails application;
|
|
48
|
+
{Active Job}[link:/files/activejob/README_md.html], a framework for declaring jobs and making them run on a variety of queueing
|
|
49
|
+
backends; {Action Cable}[link:/files/actioncable/README_md.html], a framework to
|
|
50
|
+
integrate WebSockets with a \Rails application; {Active Storage}[link:/files/activestorage/README_md.html],
|
|
51
|
+
a library to attach cloud and local files to \Rails applications; {Action Text}[link:/files/actiontext/README_md.html], a library to handle rich text content;
|
|
52
|
+
and {Active Support}[link:/files/activesupport/README_rdoc.html], a collection
|
|
53
53
|
of utility classes and standard library extensions that are useful for \Rails,
|
|
54
54
|
and may also be used independently outside \Rails.
|
|
55
55
|
|
|
@@ -72,7 +72,7 @@ and may also be used independently outside \Rails.
|
|
|
72
72
|
|
|
73
73
|
Run with <tt>--help</tt> or <tt>-h</tt> for options.
|
|
74
74
|
|
|
75
|
-
4. Go to <tt>http://localhost:3000</tt
|
|
75
|
+
4. Go to <tt>http://localhost:3000</tt>, and you'll see: "Yay! You’re on \Rails!"
|
|
76
76
|
|
|
77
77
|
5. Follow the guidelines to start developing your application. You may find the following resources handy:
|
|
78
78
|
|
data/README.rdoc
CHANGED