Almost 1 hour of digging before i gave up and built this…
(Does not support https yet)
# /abs -> http://myx.com/abs
def path_to_url(path)
"http://#{request.host_with_port_without_standard_port_handling}/#{path.sub(%r[^/],'')}"
end
Advertisement

2 comments
Comments feed for this article
2008-11-24 at 18:48:14
Luis Lavena
Hmn,
url_for for full path didn’t do the job?
http://apidock.com/rails/ActionController/Base/url_for
2008-11-24 at 19:01:51
pragmatig
nope, not enough when you got /xy/something (for example an image) and want to generate the url for it
url_for(‘/path’) only generates ‘/path’ kind of disappointing