instance method
javascript_path
Ruby on Rails 4.0.13
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" # => /javascripts/xmlhr.js javascript_path "dir/xmlhr.js" # => /javascripts/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 actionpack/lib/action_view/helpers/asset_url_helper.rb, line 233
def javascript_path(source, options = {})
path_to_asset(source, {type: :javascript}.merge!(options))
end
Defined in actionpack/lib/action_view/helpers/asset_url_helper.rb line 233
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::AssetUrlHelper