Skip to content

Instantly share code, notes, and snippets.

Created October 10, 2010 03:28
Show Gist options
  • Save anonymous/618906 to your computer and use it in GitHub Desktop.
Save anonymous/618906 to your computer and use it in GitHub Desktop.
search.html.erb
<%= form_tag(:action => "search") do %>
<%= label_tag(:q, "Search for:") %>
<%= text_field_tag(:wth) %>
<%= submit_tag("Search") %>
<% end %>
--
youtube_controller.rb
require 'youtube_g'
class YoutubeController < ApplicationController
def index
end
def search
client = YouTubeG::Client.new
@videos = client.videos_by(:query => params[:wth],:per_page => 1)
render :action => :index
end
end
--
index.html.rb
<%= @videos.inspect %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment