File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Embed video URL in rails application

 
Tejas Morabia
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 212
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic