method

javascript_path

javascript_path(source)
public

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.

Examples

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.railsapplication.com/js/xmlhr" # => http://www.railsapplication.com/js/xmlhr
javascript_path "http://www.railsapplication.com/js/xmlhr.js" # => http://www.railsapplication.com/js/xmlhr.js