Skip to content

Commit

Permalink
Merge pull request #41052 from bogdanvlviv/preload_links_header-clari…
Browse files Browse the repository at this point in the history
…fication

Make sure that `ActionView::Helpers::AssetTagHelper.preload_links_header` is `nil` without Rails 6.1 defaults
  • Loading branch information
rafaelfranca committed Jan 8, 2021
1 parent 9f68683 commit 044236e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion guides/source/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ Defaults to `'signed cookie'`.

* `config.action_view.annotate_rendered_view_with_filenames` determines whether to annotate rendered view with template file names. This defaults to `false`.

* `config.action_view.preload_links_header` determines whether `javascript_include_tag` and `stylesheet_link_tag` will generate a `Link` header that preload assets. This defaults to `true`.
* `config.action_view.preload_links_header` determines whether `javascript_include_tag` and `stylesheet_link_tag` will generate a `Link` header that preload assets.

### Configuring Action Mailbox

Expand Down Expand Up @@ -1050,6 +1050,7 @@ text/javascript image/svg+xml application/postscript application/x-shockwave-fla
- `ActiveSupport.utc_to_local_returns_utc_offset_times`: `true`
- `config.action_controller.urlsafe_csrf_tokens`: `true`
- `config.action_view.form_with_generates_remote_forms`: `false`
- `config.action_view.preload_links_header`: `true`

#### For '6.0', defaults from previous versions below and:

Expand Down Expand Up @@ -1091,6 +1092,7 @@ text/javascript image/svg+xml application/postscript application/x-shockwave-fla
- `config.action_dispatch.cookies_same_site_protection`: `nil`
- `config.action_mailer.delivery_job`: `ActionMailer::DeliveryJob`
- `config.action_view.form_with_generates_ids`: `false`
- `config.action_view.preload_links_header`: `nil`
- `config.active_job.retry_jitter`: `0.0`
- `config.active_job.skip_after_callbacks_if_terminated`: `false`
- `config.action_mailbox.queues.incineration`: `:action_mailbox_incineration`
Expand Down
8 changes: 8 additions & 0 deletions railties/test/application/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,14 @@ class ::DummySerializer < ActiveJob::Serializers::ObjectSerializer; end
assert_nil ActionView::Helpers::AssetTagHelper.preload_links_header
end

test "ActionView::Helpers::AssetTagHelper.preload_links_header is nil by default for upgraded apps" do
remove_from_config '.*config\.load_defaults.*\n'
add_to_config 'config.load_defaults "6.0"'
app "development"

assert_nil ActionView::Helpers::AssetTagHelper.preload_links_header
end

test "ActionView::Helpers::AssetTagHelper.preload_links_header can be configured via config.action_view.preload_links_header" do
app_file "config/environments/development.rb", <<-RUBY
Rails.application.configure do
Expand Down

0 comments on commit 044236e

Please sign in to comment.