hi,
i am implementing a search box from index page,search box allow s the
tag name to be searched and it should display the results on the other
page.
if enter a tag name in search box once i press the search button i am
getting error like:
ActiveRecord::RecordNotFound in StreamsController#show
Couldn't find Stream with ID=search
RAILS_ROOT: E:/srikanth/InstantRails-2.0-win/rails_apps/stdb
Application Trace | Framework Trace | Full Trace
E:/srikanth/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/base.rb:1267:in `find_one'
E:/srikanth/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/base.rb:1250:in `find_from_ids'
E:/srikanth/InstantRails-2.0-win/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/base.rb:504:in `find'
app/controllers/streams_controller.rb:16:in `show'
corresonding url have like:
http://localhost:3000/streams/search?search=352x240
so can any one help me out in this issue.
1)in controller added search method like:
####added for search option
def search
search_criteria = Article.find_tagged_with(params[:search])
if search_criteria.empty?
flash[:notice] = "Please enter search criteria"
@searchresults = ""
else
@searchresults = Streams.find
(:all, :conditions=>search_critera)
end
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @stream }
end
end