plebaba-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Mar-30 03:08 UTC
pls,explain about search action
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 -__-
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
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 resultsI think you wrongly used redirect_to. Use the render method. Maintain the Query result in a Instance Variable.> end > end > #######but i have problem about show results pls help me how can > create page to show result ? > thank you very much -__--- 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 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 -~----------~----~----~----~------~----~------~--~---
thank you very much for your help. it''s work 2009/3/30 Siddick Ebramsha <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > 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. > > > end > > end > > #######but i have problem about show results pls help me how can > > create page to show result ? > > thank you very much -__- > > -- > 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 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 -~----------~----~----~----~------~----~------~--~---