I have a application level layout and no other layouts. The layout consists of a static image wrapped in a div tag and my controllers render scaffold generated views into the "yield" statement after the header div. My header image is located in the "public/images" folder. When the "index" view of any of my controllers is rendered, everything works great. When I click any of the scaffold generated links (new, edit, show) within the "index" page, the corresponding view is rendered in the layout same as before, however the header image does not display. When viewing the console log, the log shows a 404 error to "GET /controller_name/images/header.gif". What''s going on here? Why is the path for the image in the layout changing based on the controller? If I click the edit button, which passes the record number as a parameter to the controller''s edit method the path again gets appended (GET /controller_name/1/images/header.gif). Is this a routing issue or something I haven''t setup correctly? Thanks in advance. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Because you''re referencing the image as <img src=''images/header.gif''> Use <%= image_tag("header.gif") %> instead. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Corey Murphy
2007-Dec-20 22:57 UTC
Re: img in layout disappears when controller renders view
Ryan Bigg wrote:> Because you''re referencing the image as <img src=''images/header.gif''> > > Use <%= image_tag("header.gif") %> instead.I feel dumb. Thanks. That worked great. Still learning as I go here. Thanks again, -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---