Absolute URL Generation with Subdirectory in Rails
        Posted  
        
            by Hulihan Applications
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Hulihan Applications
        
        
        
        Published on 2010-05-02T21:53:57Z
        Indexed on 
            2010/05/02
            21:58 UTC
        
        
        Read the original article
        Hit count: 210
        
ruby-on-rails
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?
© Stack Overflow or respective owner