My goal: I am trying to allow users to embed a link to a Youtube video in my site, while giving me control over the player\'s settings.
I would like to do this by only a
I think the simplest way to achieve what you're trying to do is the following:
You're trying to get from this:
http://www.youtube.com/watch?v=zb-gmJVW5lw
To this:
So you can just simply do this:
#### Use a regular expression to extract the video code
@video_id = (/([\w-]{11})/.match(@v_url)).to_s
#### Put this information in the right format
@embed_code = ""
And then in your view, just do:
<%= raw(@embed_code) %>