Home_path issue with RoR testing locally on mobile device
        Posted  
        
            by Amir
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Amir
        
        
        
        Published on 2009-12-23T06:15:43Z
        Indexed on 
            2010/06/12
            21:12 UTC
        
        
        Read the original article
        Hit count: 356
        
When I use
<%= link_to image_tag("foo.png"), home_path %>
and display it on my localhost on my iPhone, it's broken.  When I inspect on with firebug, the src of the image is http://localhost:3000/images/foo.png thus causing it to break on my iPhone.
When I use
<img src="/images/foo.png" />
it displays fine on my iPhone.  I am pointing to the IP address of my PC running the server of my rails app in Safari.  It's loading the text but all the css, JavaScript, and images are missing unless the path is absolute with using the rails default helpers.
Is there a way to correct this path issue locally so it's absolute like /images/foo.png instead of http://localhost:3000/images/foo.png.
Update
CSS file paths are also affected.  Instead of just making the path /stylesheets/foo.css, it's http://localhost:3000/stylesheets/foo.css.
Update: Solution
It's the Facebook plugin changing the asset host to the callback url of my facebook app settings which is currently set to http://localhost:3000/
© Stack Overflow or respective owner