Distributing controllers across several Rails servers and url_for

Hi,

I have an application which is split across two servers. Most of the application runs on one server, but one controller runs on another server. The second controller has no dependency on the first.

I need to generate links in the HTML that point to the second server.   I'd like to keep the existing helper functions. The documentation for url_for says I can pass in a :host option to specify a different server.

However, when I try the following in Edge Rails (version 5509):

<%= url_for(:action => "foo", :controller => "bar", :host => "hostname", :protocol => "https")%>

it only renders

/bar/foo

Should url_for work in the way I'm expecting? And if it does, will options like :host pass through form_for and remote_form_for ?

Thanks

Marcus

To follow up my own query, passing in :only_path => false generates the full desired absolute URL

Marcus

Excellent. I'm writing an app right now that will use two domains - www. and static. for static content. This will help a lot. Thank you.

Jason

Marcus Roberts wrote:

Jason,

One problem I've hit is that AJAX security means it won't access a different domain - for static files you're fine, but it won't work for javascript remoting, etc.

Marcus