aspose file tools*
The moose likes Ruby and the fly likes Embed video URL in rails application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Languages » Ruby
Bookmark "Embed video URL in rails application" Watch "Embed video URL in rails application" New topic
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: 4727

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Embed video URL in rails application