Relative_url_root and javascript_include_tag

Hi. In my environment.rb, I have:

ActionController::AbstractRequest.relative_url_root = “/foobar”

In my layout, I have:

<%= javascript_include_tag :defaults %>

Question 1:

I am getting an error:
ActionController::RoutingError (no route found to match
“/javascripts/prototype.js” with {:method=>:get}):

When I remove the relative_url_root, everything works great. What
gives?

Question 2:
What is the javascript file I want to use ajax, but no visual effects?
Can I load just one?

Thanks in advance.
–rick

Is anybody able to use javascript_include_tag with
ActionController:AbstractRequest.relative_url_root?!

Rick Foreman wrote:

Hi. In my environment.rb, I have:

ActionController::AbstractRequest.relative_url_root = “/foobar”

In my layout, I have:

<%= javascript_include_tag :defaults %>

I am getting an error:
ActionController::RoutingError (no route found to match
“/javascripts/prototype.js” with {:method=>:get}):

When I remove the relative_url_root, everything works great. What
gives?

I have the same problem, I’ve tried a zillion combinations of
configuration, and I still can’t figure out any way to solve it.

When I use the asset tag helpers with :all, :cache=>true and
relative_url_root, asset loading behavior becomes completely erratic.
Sometimes they load, sometimes they cache, and sometimes it’s a 404.

The first time I run this in production mode, I get an error like the
one you posted, saying the files could not be found. Rails is looking in
a directory structure that repeats the relative_url_root AFTER the asset
directory (some.host.com/foo/public/foo/javascripts/bar.js).

A resulting concatenated all.js file is created which is empty.

I’d be ok with moving my javascripts to the extra directory, but in
development mode (without caching), they are invisible and I get the
same same error in reverse. Furthermore in development mode, the
timestamp is not appended to the javascript files.

I can’t tell what’s breaking what… relative_url_root?
javascript_include_tag? :cache=>true?

Any help would be greatly appreciated…

thanks

Bill

Other config stuff:

OS X 10.4.10
Apache 1.3
Ruby 1.8.6
Rails 2.0.2
Mongrel 1.0.1