Rails.root problem


#1

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.

>

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.


#2

Dan S. 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