Hi all,
new to rails and trying to get youtube-g to work... I am having a difficult time passing a users search from the form_tag to the controller.. for example:
- user lands on page, enters - tiger videos - in text_field_tag
- controller takes - tiger videos - and searches
user lands on another page displaying the results...
user lands on page, enters query
index.html.erb
<%= form_tag(youtube_path) do %>
<%= label_tag(:q, "Search for:") %>
<%= text_field_tag(:wth) %>
<%= submit_tag("Search") %>
<% end %>
--
- controller takes query and searches
youtubecontroller.rb
class YoutubeController < ApplicationController
def search
require 'youtube_g'
client = YouTubeG::Client.new
client.videos_by(:query => params[:wth])
end
end
--
my routes file:
ActionController::Routing::Routes.draw do |map|
map.search “search”, :controller => “youtube”
I havn´t got to step 3 yet..
what I want is a page with just a text box and a submit button, and when a user enters text and submits, they are brought to a new page that renders 10 youtube results. any help is much appreciated!!!