instance method
asset_url
Ruby on Rails 6.1.7.10
Since v4.0.13Signature
asset_url(source, options = {})
Computes the full URL to an asset in the public directory. This will use asset_path internally, so most of their behaviors will be the same. If :host options is set, it overwrites global config.action_controller.asset_host setting.
All other options provided are forwarded to asset_path call.
asset_url "application.js" # => http://example.com/assets/application.js asset_url "application.js", host: "http://cdn.example.com" # => http://cdn.example.com/assets/application.js
Parameters
-
sourcereq -
optionsopt = {}
Source
# File actionview/lib/action_view/helpers/asset_url_helper.rb, line 230
def asset_url(source, options = {})
path_to_asset(source, options.merge(protocol: :request))
end
Defined in actionview/lib/action_view/helpers/asset_url_helper.rb line 230
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::AssetUrlHelper