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 ################ 2)and in view/streams/index.html.erb file <% form_tag(search_streams_path(), :method => :get) do %> <%= label(:search, :tag, "Search:") %><br /> <input name="search" id="tag" type="text" size="17" value='<%= session[:search_keys] %>' style="width:123px;" /> <input type="image" id="bt_zoek" src="/images/search.jpg" alt="search" style="border:none;"/> <% end %> 3)in routes.rb added line; map.resources :streams, :collection => {:search=>:get} and my database details given below: ysql> show tables; ----------------------------+ Tables_in_stdb_development | ----------------------------+ schema_info | streams | taggings | tags | ----------------------------+ rows in set (0.00 sec) ysql> select * from streams; ----+-------------------+------------+-----------+----------- +---------------------+---------------------+ id | name | resolution | codecname | framerate | created_at | updated_at | ----+-------------------+------------+-----------+----------- +---------------------+---------------------+ 1 | dust.mpeg2 | 1920x1080 | mpeg2 | 30fps | 2008-12-04 16:23:23 | 2008-12-05 13:17:16 | 2 | amelie.264 | 720x480 | h264 | 25fps | 2008-12-04 16:23:58 | 2008-12-05 12:50:26 | 3 | davincieffect.aac | NA | aac | NA | 2008-12-04 16:24:46 | 2008-12-05 13:19:51 | 4 | mummy.mpeg2 | 352x240 | mpeg2 | 30fps | 2008-12-04 16:25:41 | 2008-12-05 14:03:18 | ----+-------------------+------------+-----------+----------- +---------------------+---------------------+ rows in set (0.00 sec) ysql> select * from tags; ----+-------------+ id | name | ----+-------------+ 1 | codecname | 2 | resolution | 3 | omap | 4 | hd | 5 | omap hd | 6 | omap,hd | 7 | dvsdk | 8 | 352x240 | 9 | 352x240 264 | 10 | 264 | 11 | h264 | 12 | 1920x1080 | 13 | 720x480 | 14 | 25fps | 15 | aac | 16 | mpeg2 | ----+-------------+ 6 rows in set (0.00 sec) ysql> select * from taggings; ----+--------+-------------+---------------+ id | tag_id | taggable_id | taggable_type | ----+--------+-------------+---------------+ 14 | 8 | 4 | Stream | 17 | 14 | 2 | Stream | 18 | 13 | 2 | Stream | 19 | 12 | 1 | Stream | 20 | 15 | 3 | Stream | 21 | 16 | 4 | Stream | ----+--------+-------------+---------------+ rows in set (0.00 sec) thnaks --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

