Noob needs help with search page

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!)

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!)

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs