Forum: Ruby on Rails Rails.root problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
30d65340ad6d7fa42aeb8ef7821d05b3?d=identicon&s=25 Dan Smith (jitsudan)
on 2009-01-30 12:27
Hi,
I have a form which lets users upload an flv file to the database, this
should then be played by the "player.swf" file in the public directory.

This worked fine when on the homepage as I just referenced "player.swf"
in the html embed tag and it worked fine.

<embed
src="player.swf?file=/homepages/homepageclipurl/2.flv&autoStart=true"
width="193" height="209" quality="high"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"></emb... >

However if I left that directory eg homepage/something else, I had to
change the link to the swf file to make it work, like this.

<embed src="../player.swf?

I wanted to be able to use the same code throughout my application, so I
thought Rails.root would help, but for some reason, the video does not
display when using this technique.

Rails.root = "C:/Users/Me/Desktop/myapp"

<embed src="<%= Rails.root+"/public/player.swf" %> (Which is then
converted to..)

<embed src="C:/Users/Me/Desktop/myapp/public/player.swf?

Can anyone help me shed any light on why this might not be working?
Many Thanks.
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2009-01-30 12:40
(Received via mailing list)
Dan Smith wrote:

> I have a form which lets users upload an flv file to the database, this
> should then be played by the "player.swf" file in the public directory.

src="/player.swf?..." should work

--
Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com
This topic is locked and can not be replied to.