image_path
returns a path only (no host).
The url_for
helper won't accept a single path, so something like url_for(image_path('image.png'))
wouldn't work. While the internal url_for
in ActionDispatch::Http::Url.url_for
would appear to do the trick (source), there doesn't seem to be a public interface for it.
How should I go about doing it? Ultimately, it'd be nice to have a function like image_url
that works like url_for
does for routes so that I could call image_url('image.png')
and get the absolute URL given all of the default_url_options
.