# Pls,explain about search action

**URL:** <https://www.ruby-forum.com/t/pls-explain-about-search-action/164221>\
**Category:** Rails\
**Created:** [March 30, 2009, 5:08am UTC](https://www.ruby-forum.com/t/pls-explain-about-search-action/164221 "2009-03-30T05:08:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [March 30, 2009, 5:08am UTC](https://www.ruby-forum.com/t/pls-explain-about-search-action/164221/1 "2009-03-30T05:08:53Z")

</div>

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 -\_\_-

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [March 30, 2009, 8:32am UTC](https://www.ruby-forum.com/t/pls-explain-about-search-action/164221/2 "2009-03-30T08:32:14Z")

</div>

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 -\_\_-

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [March 30, 2009, 10:19am UTC](https://www.ruby-forum.com/t/pls-explain-about-search-action/164221/3 "2009-03-30T10:19:30Z")

</div>

thank you very much for your help. it’s work

2009/3/30 Siddick E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
