Joey Geiger
2006-Aug-15 20:49 UTC
[Rails] Using config.action_controller.asset_host with ActionController::AbstractRequest.relative_url_root
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: <link href="http://assets.example.com/app/stylesheets/main.css" media="screen" rel="Stylesheet" type="text/css" /> <script src="http://assets.example.com/app/javascripts/prototype.js" type="text/javascript"></script> ...snipped... 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?