hi i have a table called Streams with columns
name,resolution,codecname,framerate.
i have tags to the table entries if streams.like 1920x1080,aac,mpeg2...
now i have to search the table entries for tag entered in the search box.
once i enter the tag name in the search box entry i m getting errors like:
Unknown action
No action responded to get_results
can help me in this issue?
to do that i have added below codes in;
1)index.html.erb
Search: <input type="text" id="search_form"
name="search" />
<img id="spinner" src="/images/indicator.gif"
style="display: none;" />
<div id="results"></div>
<%= observe_field ''search_form'',
:frequency => 0.5,
:update => ''results'',
:url => { :controller => ''streams'', :action=>
''get_results'' },
:with => "''search_text='' + escape(value)",
:loading =>
"document.getElementById(''spinner'').style.display=''inline''",
:loaded =>
"document.getElementById(''spinner'').style.display=''none''"
%>
2)streams_controller.rb
def get_results
if request.xhr?
if params[''search_text''].strip.length > 0
terms = params[''search_text''].split.collect do |word|
"%#{word.downcase}%"
end
#@streams = Stream.find(
# :all,
# :conditions => [( ["(LOWER(name) LIKE ?)"] * terms.size
).join(" AND "),* terms.flatten])
#addded for listing the streams with a tag assigned
@streams = Stream.find_tagged_with(params[:search_text])
#@streams = Stream.find_tagged_with(params[:terms])
end
render :partial => "search"
else
redirect_to :action => "index"
end
end
3)in layouts :streams.html.erb
<html>
<head>
<title>Streams</title>
<%= javascript_include_tag :defaults %>
</head>
<body>
<%= yield %>
</body>
</html>
4)created _search.html.erb for results:
<% if @streams %>
<ul>
<% for stream in @streams %>
<li>
<%= h(stream.name) %>
</li>
<% end %>
</ul>
<% end %>
thanks
srikanth
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---