I’m trying to embed video in pages. I tried two different ways but no luck
show.html.erb
<p id="notice"><%= notice %></p>
<p>
<b>Name:</b>
<%= @video.name %>
</p>
<p>
<b>Url:</b>
<%= @video.url %>
</p>
<p>
<% #video_tag( @video.url , :size => "560x315", :controls => true, :autobuffer => true ) %>
<%= youtube_video @video.url%>
</p>
<%= link_to 'Edit', edit_video_path(@video) %> |
<%= link_to 'Back', videos_path %>
The video does not show neither does the links below it.
Any tips would be appreciated. Thank you
this is the debug result
ActionView::MissingTemplate in Videos#show
Showing
/Users/atbyrd/Documents/sites/city/app/views/videos/show.html.erb
where line #15 raised:Missing partial shared/video with {:handlers=>[:erb, :builder,
:coffee], :formats=>[:html], :locale=>[:en, :en]}. Searched in: *
“/Users/atbyrd/Documents/sites/city/app/views” *
“/Users/atbyrd/.rvm/gems/ruby-1.9.2-p290/gems/devise-1.5.1/app/views”Extracted source (around line #15):
12: 13:
14: <% #video_tag( @video.url , :size => “560×315”,
:controls => true, :autobuffer => true ) %> 15: <%= youtube_video
@video.url%> 16:17: 18: <%= link_to ‘Edit’,
edit_video_path(@video) %> |Rails.root: /Users/atbyrd/Documents/sites/city Application Trace |
Framework Trace | Full Traceapp/helpers/application_helper.rb:4:in
youtube_video'_app_views_videos_show_html_erb__1532956397246631491_70281299458880′
app/views/videos/show.html.erb:15:in
app/controllers/videos_controller.rb:18:in `show’
you have forgotten to close a bracket
should be
UPDATE:
Try using video_path instead of video_tag.
2nd UPDATE:
here’s how I do this myself on my own site:
1 – create a partial called _video.html.erb (I actually use haml, but erb will do if you prefer it) and put it in a folder like views/shared or something ad put the following code in it:
2 add the following method to application_helper.rb
3 – now just call this in your views with:
This works ok for me