This project is archived and is in readonly mode.
RAILS_RELATIVE_URL_ROOT problem in compute_public_path
Reported by Nicholas J Kreucher | June 9th, 2010 @ 08:16 AM
I'm using rails 3.0.0.Beta4 w/Jruby 1.5 and warbler 1.1.0. This works in Rails 2.3.5.
When deploying to an app server with a non-/ context root (ex: /subdir), asset tags (image_tag et al) do not generate correct links: they do not prefix the /subdir. Links via link_to etc are correctly generated, and the app otherwise runs fine.
ENV["RAILS_RELATIVE_URL_ROOT"] reports correctly, and I noticed the deprecated(??) controller.config.relative_url_root is being used in compute_public_path. I've attached a patch that swaps this out for ENV["RAILS_RELATIVE_URL_ROOT"]. Not sure if this is a valid solution, but it fixes the asset tag link generation for me.
HOWEVER, something else is wrong... as /subdir/images/test.png, for example, ends up throwing a routing error. Same for javascript, css and other assets.
Comments and changes to this ticket
-
Yehuda Katz (wycats) June 11th, 2010 @ 12:36 AM
- State changed from new to invalid
Why do you need to set the relative root via an environment variable? If you really must do this, you can set the config yourself in application.rb based on this variable.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>