# Noob needs help with search page

**URL:** <https://www.ruby-forum.com/t/noob-needs-help-with-search-page/84713>\
**Category:** Rails\
**Created:** [February 7, 2007, 5:18am UTC](https://www.ruby-forum.com/t/noob-needs-help-with-search-page/84713 "2007-02-07T05:18:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![planalpha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9bd4f/32.png) [@planalpha](https://www.ruby-forum.com/u/planalpha)\
**Post date:** [February 7, 2007, 5:18am UTC](https://www.ruby-forum.com/t/noob-needs-help-with-search-page/84713/1 "2007-02-07T05:18:29Z")

</div>

In an attempt to learn RoR, I’m porting a simple contact manager app I  
wrote in PHP/MySQL to RoR. I’ve gotten most of it to work and learned a  
lot along the way, but I simply cannot get the searching to work, and  
I’m sure I’m just making it harder than it really is. I sure could use a  
hand. I have a search page that has a text field and a pulldown box with  
the following options that coralate with the fields in the db:

Table name == contacts  
Field names:

firstName  
lastName  
email1  
email2  
phone1  
phone2  
street  
city  
state  
zip  
birthDay  
notes

…and displayed the results.

So if I want a search page, what do I do? What do I put in my  
contacts\_controller (def search … I’m assuming),  
my search.rhtml? Do I need a results page too, or do they get posted in  
the same page? Do I have to add anything  
to a view, too?

Many, many thanks!!! (I’m pulling my hair out!)

---

<div class="post-metadata">

**Author:** ![planalpha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9bd4f/32.png) [@planalpha](https://www.ruby-forum.com/u/planalpha)\
**Post date:** [February 7, 2007, 4:53pm UTC](https://www.ruby-forum.com/t/noob-needs-help-with-search-page/84713/2 "2007-02-07T16:53:20Z")

</div>

try using acts\_as\_ferret. you just need to index each field in your  
contacts model.

Plan Alpha wrote:

> In an attempt to learn RoR, I’m porting a simple contact manager app I  
> wrote in PHP/MySQL to RoR. I’ve gotten most of it to work and learned a  
> lot along the way, but I simply cannot get the searching to work, and  
> I’m sure I’m just making it harder than it really is. I sure could use a  
> hand. I have a search page that has a text field and a pulldown box with  
> the following options that coralate with the fields in the db:
> 
> Table name == contacts  
> Field names:
> 
> firstName  
> lastName  
> email1  
> email2  
> phone1  
> phone2  
> street  
> city  
> state  
> zip  
> birthDay  
> notes
> 
> …and displayed the results.
> 
> So if I want a search page, what do I do? What do I put in my  
> contacts\_controller (def search … I’m assuming),  
> my search.rhtml? Do I need a results page too, or do they get posted in  
> the same page? Do I have to add anything  
> to a view, too?
> 
> Many, many thanks!!! (I’m pulling my hair out!)

---

<div class="post-metadata">

**Author:** ![planalpha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9bd4f/32.png) [@planalpha](https://www.ruby-forum.com/u/planalpha)\
**Post date:** [February 7, 2007, 2:21pm UTC](https://www.ruby-forum.com/t/noob-needs-help-with-search-page/84713/3 "2007-02-07T14:21:24Z")

</div>

Also, I don’t need anything too fancy like act\_as\_ferret or act\_as\_sol,  
just a simple MySQL LIKE search will work fine. Links to tutorials or  
examples would be great!  
Thanks
