Hi, I''m having a problem with the routing within my rails app. I''m probably doing something completely, obviously, and totally wrong, but for the life of me I can''t see it. The short of it: My banner disappears if my url goes beyond displaying the controller name. Case in point: # the banner displays correctly when viewing the home page http://localhost:3000/home #Right click the banner and select show background image #Banner url - everything is fine http://localhost:3000/images/logo1.png #Banner disappears when viewing an article however http://localhost:3000/article/show/5 #Right click the banner and select show background image #banner url - the article controller is embedded in the url http://localhost:3000/article/images/logo1.png To help simplify the problem I removed the css file and hard coded the banner into the div: <div id="logo" style="width: 700px;background-image: url(../images/logo1.png)"> Anyone have a good place for me to start looking? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Haha, ok that was it, thank you very much! I want to crawl to the bottom of a hole for missing something that obvious. On 3/7/07, Philip Hallstrom <rails-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote:> > > > Hi, I''m having a problem with the routing within my rails app. I''m > probably > > doing something completely, obviously, and totally wrong, but for the > life > > of me I can''t see it. > > > > The short of it: My banner disappears if my url goes beyond displaying > the > > controller name. > > > > Case in point: > > # the banner displays correctly when viewing the home page > > http://localhost:3000/home > > > > #Right click the banner and select show background image > > #Banner url - everything is fine > > http://localhost:3000/images/logo1.png > > > > #Banner disappears when viewing an article however > > http://localhost:3000/article/show/5 > > > > #Right click the banner and select show background image > > #banner url - the article controller is embedded in the url > > http://localhost:3000/article/images/logo1.png > > > > To help simplify the problem I removed the css file and hard coded the > > banner into the div: > > <div id="logo" style="width: 700px;background-image: > > url(../images/logo1.png)"> > > make it like this: url(/images/logo1.png) > > The "../" makes it relative to the url you are at. > > So... > > ...:3000/home -> home/../images/logo1.png -> /images/logo1.png > > ...:3000/article/show/5 -> article/show/5/../images/logo1.png -> > article/show/images/logo1.png > > Which is exactly what you''re seeing. Just make the url reference absolute > (ie. start it with a ''/'') and you''ll be fine. I''d recommend doing this > for *all* your assets (images, javascript, stylesheets, etc.) > > -philip > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Hi, I''m having a problem with the routing within my rails app. I''m probably > doing something completely, obviously, and totally wrong, but for the life > of me I can''t see it. > > The short of it: My banner disappears if my url goes beyond displaying the > controller name. > > Case in point: > # the banner displays correctly when viewing the home page > http://localhost:3000/home > > #Right click the banner and select show background image > #Banner url - everything is fine > http://localhost:3000/images/logo1.png > > #Banner disappears when viewing an article however > http://localhost:3000/article/show/5 > > #Right click the banner and select show background image > #banner url - the article controller is embedded in the url > http://localhost:3000/article/images/logo1.png > > To help simplify the problem I removed the css file and hard coded the > banner into the div: > <div id="logo" style="width: 700px;background-image: > url(../images/logo1.png)">make it like this: url(/images/logo1.png) The "../" makes it relative to the url you are at. So... ...:3000/home -> home/../images/logo1.png -> /images/logo1.png ...:3000/article/show/5 -> article/show/5/../images/logo1.png -> article/show/images/logo1.png Which is exactly what you''re seeing. Just make the url reference absolute (ie. start it with a ''/'') and you''ll be fine. I''d recommend doing this for *all* your assets (images, javascript, stylesheets, etc.) -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Joe, could you provide a snippet of code (i.e. Ruby template) that contains the image? In any case, you should be referencing images in you templates as follows: /images/some_image.image_extension I was faced with this same issue last night because the pages where using images/some_image.image_extension which was an incorrect usage and was referring to a different directory on my server. Good luck, -Conrad On 3/7/07, Joe Cairns <joe.cairns-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, I''m having a problem with the routing within my rails app. I''m probably > doing something completely, obviously, and totally wrong, but for the life > of me I can''t see it. > > The short of it: My banner disappears if my url goes beyond displaying the > controller name. > > Case in point: > # the banner displays correctly when viewing the home page > http://localhost:3000/home > > #Right click the banner and select show background image > #Banner url - everything is fine > http://localhost:3000/images/logo1.png > > #Banner disappears when viewing an article however > http://localhost:3000/article/show/5 > > #Right click the banner and select show background image > #banner url - the article controller is embedded in the url > http://localhost:3000/article/images/logo1.png > > To help simplify the problem I removed the css file and hard coded the > banner into the div: > <div id="logo" style="width: 700px;background-image: > url(../images/logo1.png)"> > > Anyone have a good place for me to start looking? > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---