I want to specify the exact root to play video files in my r

Hi all,

can anyone please get me a solution for the problem i am facing in my
project…

i am using this path

VALUE="#{RAILS_ROOT}/<%[email protected]_path%>"

to display and play a video in my project

where @f.content_path this variable prints a root like this

#{RAILS_ROOT}/E:/project_name/public/folder_name/id/file.mpg

but its not at all working…

if the path is like this /public/folder_name/id/file.mpg

when i embed like this… its working… what could be the problem?

<%if @f_len!=0%> <%for @f in @focus%> <%if @f.content_type=='Videos'%> <%puts @f.content_path%> <%puts @f.id%> <%else%> <%=link_to_remote(image_tag(url_for_file_column("f", "image_path",:big)))%> <%end%> <%end%> <%else%> NO PREVIEW <%end%>

it’s basically a bad idea, to create paths like this:
“#{RAILS_ROOT}/<%[email protected]_path%>”

use the File.join method instead
File.join(RAILS_ROOT, @f.content_path)
this will save you a lot of trouble with missing slashes etc.

#{RAILS_ROOT}/E:/project_name/public/folder_name/id/file.mpg
cant work
assume a windows machine and your project is:
C:\projects\myproject
which is rails_root then

C:\projects\myproject/E:/project_name/public/folder_name/id/file.mpg

that’s not a valid path, eg because of the two discs C: E: and the mix
of slashes/backslashes

what kind of OS are you using, since the drive letters would be Windows
like, but you use the slashes like for unix or mac?

Thorsten M. wrote:

it’s basically a bad idea, to create paths like this:
“#{RAILS_ROOT}/<%[email protected]_path%>”

use the File.join method instead
File.join(RAILS_ROOT, @f.content_path)
this will save you a lot of trouble with missing slashes etc.

#{RAILS_ROOT}/E:/project_name/public/folder_name/id/file.mpg
cant work
assume a windows machine and your project is:
C:\projects\myproject
which is rails_root then

C:\projects\myproject/E:/project_name/public/folder_name/id/file.mpg

that’s not a valid path, eg because of the two discs C: E: and the mix
of slashes/backslashes

what kind of OS are you using, since the drive letters would be Windows
like, but you use the slashes like for unix or mac?

i am using windows xp

basically #{RAILS_ROOT} will take the path where the project will be.so
in my task if i give
#{RAILS_ROOT}@f.content_path means it should show the path like
\public\folder_name\id\file.mpg right? but instead it shows the path as
E:\project_name\public\folder_name\id\file.mpg. how to solve this
problem…

thanks,
barak

On 15 Feb 2008, at 16:24, Bala Krishnan wrote:

basically #{RAILS_ROOT} will take the path where the project will
be.so
in my task if i give
#{RAILS_ROOT}@f.content_path means it should show the path like
\public\folder_name\id\file.mpg right? but instead it shows the path
as
E:\project_name\public\folder_name\id\file.mpg. how to solve this
problem…

Um no. RAILS_ROOT is the location on disk of your rails app, ie E:
\project_name in your case.
I’ve no idea what f and its content_path method are, but what you want
to give to the user’s browser is a path relative to the public/ folder
in your rails app

Fred

forget about RAILS_ROOT on the browser-site. only use relative url

if i want to display an image in /public/files, i would use this:
“/files/#{image.image_filename}”
if the images are in /public/files

everything else will be resolved by the browser and server

so your line
SRC="#{RAILS_ROOT}/<%[email protected]_path%>"

should work like this:
SRC="<%[email protected]_path%>"
if content_path points to the right place and does not have the leading
/public