Hi all, I have a possibly dumb question. In my template, I reference the images folder by "../images/foo.jpg". This works with all my pages that are two levels - i.e. this works for example with "../items/list" page. However, when I go one level deeper, for example "../items/show/235" page, this doesn''t work, because images need to be referenced by "../../images/foo.jpg" Is there a quick and elegant Rails-like solution to this? Can I do something like "~/images/foo.jpg" (it has to work both on Windows, where I''m developing this, and Linux, where this is going to be deployed)? I really don''t want to refer to all images by their absolute path... Thanks! -- 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 -~----------~----~----~----~------~----~------~--~---
On Mar 21, 2007, at 7:47 PM, zavulon wrote:> > Hi all, > > I have a possibly dumb question. > > In my template, I reference the images folder by "../images/foo.jpg". > This works with all my pages that are two levels - i.e. this works for > example with "../items/list" page. > > However, when I go one level deeper, for example "../items/show/235" > page, this doesn''t work, because images need to be referenced by > "../../images/foo.jpg" > > Is there a quick and elegant Rails-like solution to this? Can I do > something like "~/images/foo.jpg" (it has to work both on Windows, > where > I''m developing this, and Linux, where this is going to be deployed)? I > really don''t want to refer to all images by their absolute path... > > Thanks! >Don''t use relative paths like that. If you just always use a path like "/images/foo.jpg" it will work no matter how nested your pages are. Cheers- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez-NLltGlunAUd/unjJdyJNww@public.gmane.org -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you, that works perfectly! I had a suspicion ''twas a stupid question... -- 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 -~----------~----~----~----~------~----~------~--~---