Forum: Ruby on Rails How to reference the "public" folder from "app/views/..."

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B9a94345714e260dbf1285f3c7cbc81c?d=identicon&s=25 Nebs Petrovic (bloodsample)
on 2009-01-30 19:43

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.
A82ba1167f4d4a8d1de63820e576a87f?d=identicon&s=25 Robby Russell (Guest)
on 2009-01-30 19:47
(Received via mailing list)
/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
<> wrote:
> <embed src="../public/flash/mymovie.swf" width="400" height="163">
> thin air?
> >

Robby Russell
Chief Evangelist, Partner

design // development // hosting w/Ruby on Rails
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]
This topic is locked and can not be replied to.