| Author |
Embed video URL in rails application
|
Tejas Morabia
Greenhorn
Joined: Mar 06, 2010
Posts: 7
|
|
hi,
I have a doubt which might be silly for experience Rails developers.
I am creating an application which is suppose to embed a video player with URL passed to it.
So while displaying i.e in XXX.html.erb file i am writting below code. Now problem is @movie.trailer is my variable in ruby code which has URL value . I want the embedded video to load with URL given by this variable value. Any suggestion how am i suppose to place the value of Ruby variable(@movie.trailer) in <embed src="variable_value"> part.
Note :- This code is working perfectly fine if i statically give value of URL.
Please help
|
 |
David McCombs
Ranch Hand
Joined: Oct 17, 2006
Posts: 212
|
|
The double quotes is telling Ruby that it is a string so what you are probably getting for src is literally "<% @movie.trailer %>". Try "#{<% @movie.trailer %>}" and make sure that @movie.trailer is returning a string, or just remove the double quotes. You could also place a method in the helper module to generate the string in the correct format.
edit:
If you want the results of the code to display you need <%= %>, but I don't think that takes care of the string concatenation.
|
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
|
 |
Marc Peabody
pie sneak
Sheriff
Joined: Feb 05, 2003
Posts: 4725
|
|
You need to do <%= @movie.trailer %> with the equals sign.
<% @movie.trailer %> without equals will evaluate the expression but will not render to the page.
|
A good workman is known by his tools.
|
 |
 |
|
|
subject: Embed video URL in rails application
|
|
|