1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make AssetTagHelper#preload_link_tag to use path_to_asset method instead of asset_path.

To avoid conflicts with an asset_path named route.

Closes https://github.com/rails/rails/issues/42545
This commit is contained in:
Vasiliy Ermolovich 2021-06-23 18:55:11 +03:00
parent 97b494fefb
commit c69f6b1bc7

View file

@ -317,7 +317,7 @@ module ActionView
# # => <link rel="preload" href="/media/audio.ogg" as="audio" type="audio/ogg" />
#
def preload_link_tag(source, options = {})
href = asset_path(source, skip_pipeline: options.delete(:skip_pipeline))
href = path_to_asset(source, skip_pipeline: options.delete(:skip_pipeline))
extname = File.extname(source).downcase.delete(".")
mime_type = options.delete(:type) || Template::Types[extname]&.to_s
as_type = options.delete(:as) || resolve_link_as(extname, mime_type)