Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

RAILS_RELATIVE_URL_ROOT problem in compute_public_path

#4805

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.

Reported by Nicholas J Kreucher · June 9th, 2010 @ 08:16 AM

State: invalid
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Yehuda Katz (wycats)
    Yehuda Katz (wycats)
    • 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.

    June 11th, 2010 @ 12:36 AM