Ruby on Rails Thursday, May 1, 2014

Whatever the user passes you gonna find it in the params hash so in your case:

@videos = $client.videos_by(:tags => params[:search])


On Wednesday, April 30, 2014 5:59:19 PM UTC+2, Ruby-Forum.com User wrote:
I've been able to set things up to display a result of queries using
youtube_it gem my current code for fetching that data is

def index
$client = YouTubeIt::Client.new(:dev_key =>
"AI39si6i1NPgrU35e6xxRgvtGclAdH9pHnwefuUbHKZmKJutqDNvTZwY3PawefEY9rarYzmpN__UuMH19bAny0-retoMa8IsNILlDA")
@videos = $client.videos_by(:tags => ['funnyvideo'])
end


The thing is that I want to allow the user to input what they want to
search instead of me putting in funny video, I want a search bar that
allows users to type in their tags.


My current search bar looks something like this
<% form_tag videos_path, :method 'get' do %>
<%= text_field_tag :search %>
<%= submit_tag "search" %>
<% end %>


How can I pass in whatever the user type into the search bar to fetch
the youtube tags?


Thanks

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/78370e48-54ec-41a7-97e0-9a3267508f1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment