image_path returns only the path (without a host).
The url_for helper url_for not accept any paths, so something like url_for(image_path('image.png')) will not work. Although the inner url_for in ActionDispatch::Http::Url.url_for seems to do the trick ( source ), there seems to be no open interface for it.
How should I do it? Ultimately, it would be nice to have a function like image_url that works like url_for for routes, so I could call image_url('image.png') and get the absolute URL given to all default_url_options .
ruby-on-rails ruby-on-rails-3
Steven Xu Jun 27 '11 at 23:15 2011-06-27 23:15
source share