Nebs Petrovic
2009-Jan-30 18:43 UTC
How to reference the "public" folder from "app/views/..."
Hello, In my application.html.erb layout I have a reference to a .swf (flash movie) file that I want to embed. I put the swf file in the "public/flash" directory (I created the "flash" folder). My question is how do I get a reference to the "public" folder that rails created from within a view template that is in "app/views/etc.." ? So that I can do something like: <embed src="../public/flash/mymovie.swf" width="400" height="163"> The ".." doesn''t point to the application root so I don''t know how else to access the public folder. I''m not really sure what the "root" is when it comes to the html that rails uses. When rails translates all the .html.erb stuff to plain html where does this all run from? For example when you check the source code of a page from a browser you can see plain html that rails generated using all its fancy methods. But where does this plain html live? Is it generated on the fly upon request and then disappears into thin air? I''ve always been confused about this "html.erb" to "html" magic and any clarification on the matter is greatly appreciated. (Sorry for the 2 questions in one) 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 -~----------~----~----~----~------~----~------~--~---
Robby Russell
2009-Jan-30 18:46 UTC
Re: How to reference the "public" folder from "app/views/..."
/public is the root of the public site... so just <embed src="/flash/mymovie.swf" width="400" height="163"> On Fri, Jan 30, 2009 at 10:43 AM, Nebs Petrovic <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hello, > > In my application.html.erb layout I have a reference to a .swf (flash > movie) file that I want to embed. I put the swf file in the > "public/flash" directory (I created the "flash" folder). > > My question is how do I get a reference to the "public" folder that > rails created from within a view template that is in "app/views/etc.." ? > So that I can do something like: > <embed src="../public/flash/mymovie.swf" width="400" height="163"> > > The ".." doesn''t point to the application root so I don''t know how else > to access the public folder. > > I''m not really sure what the "root" is when it comes to the html that > rails uses. When rails translates all the .html.erb stuff to plain html > where does this all run from? For example when you check the source > code of a page from a browser you can see plain html that rails > generated using all its fancy methods. But where does this plain html > live? Is it generated on the fly upon request and then disappears into > thin air? > > I''ve always been confused about this "html.erb" to "html" magic and any > clarification on the matter is greatly appreciated. > > (Sorry for the 2 questions in one) > > Thanks in advance. > -- > Posted via http://www.ruby-forum.com/. > > > >-- Robby Russell Chief Evangelist, Partner PLANET ARGON, LLC design // development // hosting w/Ruby on Rails http://www.planetargon.com/ http://www.robbyonrails.com/ aim: planetargon +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4068 [fax] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---