I’m looking for some help with an issue I’m having using an external
asset host. I’ve got the lines below in my environments/development.rb
file.
Enable serving of images, stylesheets, and javascripts from an asset
server
config.action_controller.asset_host = “http://assets.example.com”
#make rails think it lives in /app
ActionController::AbstractRequest.relative_url_root = “/app”
When I then include the this code in my layouts:
<%= stylesheet_link_tag ‘main’ %>
<%= javascript_include_tag :defaults %>
it produces the following output:
My question is that if I’m serving from an asset host, why does it
have the /app between the hostname and the stylesheets/javascripts? If
I’m using an external host, it shouldn’t know or care where my
application thinks it’s living, right?
Is this a bug, and if it’s not, is there a way I can get around it,
while still having my application live in /app?