First of all have a read at rails asset pipeline and read difference between developement and production way of serving assets this will help you understand how the assets are served If you add an erb extension to a JavaScript asset, making it something such as application.js.erb, then you can use the asset_path helper in your JavaScript code: