dimanche 26 avril 2015

How can I retrieve this as hash?

I'm using this gem called youtube_search

Then I want to show 20 embed videos on my page.

Here's my code

<% @videos = YoutubeSearch.search('cats', :page => 1, :per_page => 20, 'orderby' => 'viewCount') %>

<% @videos.each do |video| %>
    <iframe src="http://ift.tt/1OUNE2I}" width=640 height=480 frameborder=0></iframe><br />
<% end %>

But this returns this error :(

ActionView::Template::Error (400 Bad Request):
    28: 
    29: <%#= YoutubeSearch.search('cats', :page => 1, :per_page => 20, 'orderby' => 'viewCount').first %>
    30: 
    31: <% @videos = YoutubeSearch.search('cats', :page => 1, :per_page => 20, 'orderby' => 'viewCount').first %>
    32: 
    33: <% @videos.each do |video| %>
    34: <iframe src="http://ift.tt/1OUNE2I}" width=640 height=480 frameborder=0></iframe><br />
  app/views/movies/index.html.erb:31:in `_app_views_movies_index_html_erb__3015092106786823575_115631080'
  app/controllers/movies_controller.rb:7:in `index'

How can I fix this?

Aucun commentaire:

Enregistrer un commentaire