instance method
javascript_path
Ruby on Rails 7.0.10
Since v4.0.13Signature
javascript_path(source, options = {})
Computes the path to a JavaScript asset in the public javascripts directory. If the source filename has no extension, .js will be appended (except for explicit URIs) Full paths from the document root will be passed through. Used internally by javascript_include_tag to build the script path.
javascript_path "xmlhr" # => /assets/xmlhr.js javascript_path "dir/xmlhr.js" # => /assets/dir/xmlhr.js javascript_path "/dir/xmlhr" # => /dir/xmlhr.js javascript_path "http://www.example.com/js/xmlhr" # => http://www.example.com/js/xmlhr javascript_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js
Parameters
-
sourcereq -
optionsopt = {}
Source
# File actionview/lib/action_view/helpers/asset_url_helper.rb, line 320
def javascript_path(source, options = {})
path_to_asset(source, { type: :javascript }.merge!(options))
end
Defined in actionview/lib/action_view/helpers/asset_url_helper.rb line 320
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::AssetUrlHelper