Forum: Ruby on Rails noob needs help with search page...

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0915ea5c8aaf9313843a5d2ebb6990c2?d=identicon&s=25 Plan Alpha (planalpha)
on 2007-02-07 05:18
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!)
0915ea5c8aaf9313843a5d2ebb6990c2?d=identicon&s=25 Plan Alpha (planalpha)
on 2007-02-07 14:21
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
3d1a70ebd35ac970e009e01599603b46?d=identicon&s=25 koloa (Guest)
on 2007-02-07 16:53

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!)
This topic is locked and can not be replied to.