Full Asset URL in a Rails .js.erb file
问题 I have a bookmarklet that can be loaded on any website. It works like this; loads http://my.example.com/assets/bookmarklet.js includes http://my.example.com/assets/bookmarklet.css The css file is added to the dom via bookmarklet.js , so it needs to know where this is. My code is as follows; // assets/javascripts/bookmarklet.js.erb var config = { stylesheetUrl: '<%= asset_path("bookmarklet.css", :only_path => false) %>' } But no matter what I try this renders as var config = { stylesheetUrl: '