Method: ActionView::Helpers::AssetTagHelper#javascript_path

Defined in:
lib/action_view/helpers/asset_tag_helper.rb

#javascript_path(source) ⇒ Object

Computes the path to a javascript asset in the public javascripts directory. If the source filename has no extension, .js will be appended. 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


55
56
57
# File 'lib/action_view/helpers/asset_tag_helper.rb', line 55

def javascript_path(source)
  compute_public_path(source, 'javascripts', 'js')        
end