views:

124

answers:

1

I want to construct a url within my rails app that points to another server that isn't running rails. Using url_for almost satisfies my requirements, but it requires a controller key which I don't need (redirecting to a top level page on the external site).

The reason I want to do this is so that I have a cleanly construct a url with a hash of arguments (some of which are determined at runtime).

A: 

What do you think about URI::HTTP?

Thomas
unfortunately i can't pass in the query string as a has as I would have preferred, but it's close enough. I find it a bit odd that using `HTTPS::build` with the `to_s` method returns a https uri, while using the `request_uri` method returns a http uri.
Tom Bennett
I do not know an easy solution for the hash into prameters problem. If you dont't need nested parameters you can probably create a simple function to do this. The URI::HTTPS.request_uri() Function returns only the path and query string. Everything before is left out. You can try it easily in the Rails console.
Thomas