Hello, i want create web page for searching items in database. i try to run code to find items in script/console it's work.but i have problem about show results after find items in database finish. pls, explain me what next step that i can do. def search @title = "Search" if params[:q] #receives query from user initial= params[:q] seqs = Seq.find(:all, #find item in Seq database by finding the org_name :conditions => "org_name LIKE '#{initial}%'", :order => "seq_id, org_name") redirect_to :controller => "result", :action => "index" #after searching go to index page for show results end end #######but i have problem about show results pls help me how can create page to show result ? thank you very much -__-
Thiti Panya wrote:
Hello, i want create web page for searching items in database. i try to run code to find items in script/console it's work.but i have problem about show results after find items in database finish. pls, explain me what next step that i can do. def search @title = "Search" if params[:q] #receives query from user initial= params[:q] seqs = Seq.find(:all, #find item in Seq database by finding the org_name :conditions => "org_name LIKE '#{initial}%'", :order => "seq_id, org_name") redirect_to :controller => "result", :action => "index" #after searching go to index page for show results
I think you wrongly used redirect_to. Use the render method. Maintain the Query result in a Instance Variable.
thank you very much for your help. it’s work