Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that ActionView::Helpers::AssetTagHelper.preload_links_header is nil without Rails 6.1 defaults #41052

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion guides/source/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,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 @@ -1059,6 +1059,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 @@ -1100,6 +1101,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 @@ -2410,6 +2410,14 @@ class ::DummySerializer < ActiveJob::Serializers::ObjectSerializer; end
assert_equal true, 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