Absolute URL Generation with Subdirectory in Rails
- by Hulihan Applications
Hey Guys -
I'm trying to find an easy way(without having to write any plugins or overrides to Rails) to generate an absolute url to a rails application being in a subdirectory. This url is going to be generated for theme images, not links, so I can't url link_to or url_for. Here's an example of what I want to do:
<%= theme_image("delete_icon.png", :theme => "my_theme") %>
If my app is running at http://localhost, This would return:
<img src="/themes/my_theme/images/delete_icon.png">
but If my app is running at http://localhost/myapp, This would return:
<img src="/myapp/themes/my_theme/images/delete_icon.png">
Can anyone point me in the right direction to generate a dynamic, absolute url to a non-routed resource?