Merge pull request #37595

Closes #37595
上级 3fdd5f51
......@@ -879,31 +879,17 @@ text/javascript image/svg+xml application/postscript application/x-shockwave-fla
* `config.active_storage.replace_on_assign_to_many` determines whether assigning to a collection of attachments declared with `has_many_attached` replaces any existing attachments or appends to them. The default is `true`.
<<<<<<< HEAD
### Results of `load_defaults`
=======
* `config.active_storage.draw_routes` can be used to toggle Active Storage route generation. The default is `true`.
#### With '5.0':
### Results of `config.load_defaults`
>>>>>>> b2864a2069... Merge pull request #37595
- `config.action_controller.per_form_csrf_tokens`: `true`
- `config.action_controller.forgery_protection_origin_check`: `true`
- `ActiveSupport.to_time_preserves_timezone`: `true`
- `config.active_record.belongs_to_required_by_default`: `true`
- `config.ssl_options`: `{ hsts: { subdomains: true } }`
#### With '5.1':
- `config.assets.unknown_asset_fallback`: `false`
- `config.action_view.form_with_generates_remote_forms`: `true`
`config.load_defaults` sets new defaults up to and including the version passed. Such that passing, say, '6.0' also gets the new defaults from every version before it.
#### With '5.2':
- `config.active_record.cache_versioning`: `true`
- `action_dispatch.use_authenticated_cookie_encryption`: `true`
- `config.active_support.use_authenticated_message_encryption`: `true`
- `config.active_support.use_sha1_digests`: `true`
- `config.action_controller.default_protect_from_forgery`: `true`
- `config.action_view.form_with_generates_ids`: `true`
#### With '6.0':
#### For '6.0', new defaults from previous versions below and:
- `config.autoloader`: `:zeitwerk`
- `config.action_view.default_enforce_utf8`: `false`
......@@ -916,6 +902,28 @@ text/javascript image/svg+xml application/postscript application/x-shockwave-fla
- `config.active_storage.replace_on_assign_to_many`: `true`
- `config.active_record.collection_cache_versioning`: `true`
#### For '5.2', new defaults from previous versions below and:
- `config.active_record.cache_versioning`: `true`
- `config.action_dispatch.use_authenticated_cookie_encryption`: `true`
- `config.active_support.use_authenticated_message_encryption`: `true`
- `config.active_support.use_sha1_digests`: `true`
- `config.action_controller.default_protect_from_forgery`: `true`
- `config.action_view.form_with_generates_ids`: `true`
#### For '5.1', new defaults from previous versions below and:
- `config.assets.unknown_asset_fallback`: `false`
- `config.action_view.form_with_generates_remote_forms`: `true`
#### For '5.0':
- `config.action_controller.per_form_csrf_tokens`: `true`
- `config.action_controller.forgery_protection_origin_check`: `true`
- `ActiveSupport.to_time_preserves_timezone`: `true`
- `config.active_record.belongs_to_required_by_default`: `true`
- `config.ssl_options`: `{ hsts: { subdomains: true } }`
### Configuring a Database
Just about every Rails application will interact with a database. You can connect to the database by setting an environment variable `ENV['DATABASE_URL']` or by using a configuration file called `config/database.yml`.
......
......@@ -71,6 +71,7 @@ def initialize(*)
@add_autoload_paths_to_load_path = true
end
# Loads default configurations. See {the result of the method for each version}[https://guides.rubyonrails.org/configuring.html#results-of-config-load-defaults].
def load_defaults(target_version)
case target_version.to_s
when "5.0"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册