module ActionView::Helpers::AssetUrlHelper
def javascript_url(source, options = {})
javascript_url "js/xmlhr.js", host: "http://stage.example.com" # => http://stage.example.com/assets/js/xmlhr.js
options is set, it overwrites global +config.action_controller.asset_host+ setting.
Since +javascript_url+ is based on +asset_url+ method you can set +:host+ options. If +:host+
This will use +javascript_path+ internally, so most of their behaviors will be the same.
Computes the full URL to a JavaScript asset in the public javascripts directory.
def javascript_url(source, options = {}) url_to_asset(source, { type: :javascript }.merge!(options)) end