Reputation:
I'm trying to get this to work.
<%= image_tag('http://img.youtube.com/vi/<%= @video_tag %>/hqdefault.jpg') %>
It works with just the link itself but the image_tag to display it is causing the following error:
Error:
Showing /Users/maine/Downloads/leap_stage_v2/leap_stage_v2/app/views/songs/show.html.erb where line #19 raised:
/Users/maine/Downloads/leap_stage_v2/leap_stage_v2/app/views/songs/show.html.erb:19: syntax error, unexpected $undefined, expecting ')'
...er.safe_append='/hqdefault.jpg\') %>
... ^
/Users/maine/Downloads/leap_stage_v2/leap_stage_v2/app/views/songs/show.html.erb:68: syntax error, unexpected keyword_ensure, expecting ')'
/Users/maine/Downloads/leap_stage_v2/leap_stage_v2/app/views/songs/show.html.erb:70: syntax error, unexpected keyword_end, expecting ')'
Extracted source (around line #19):
http://img.youtube.com/vi/<%= @video_tag %>/hqdefault.jpg
<%= image_tag('http://img.youtube.com/vi/<%= @video_tag %>/hqdefault.jpg') %>
<div class="videos">
Upvotes: 0
Views: 398
Reputation: 38645
You cannot nest the <%
tags. Assuming @video_tag
is a string, you can do the following to achieve what you want:
<%= image_tag("http://img.youtube.com/vi/#{@video_tag}/hqdefault.jpg") %>
Upvotes: 1