Search/advanced search


#1

Hello,

How do you handle advanced searches in Rails, i.e., anything more than
one field?

I searched the archives but wasn’t able to find a good example of this.
[I also noticed the forum itself has no advanced search yet!]

This is another of those common scenarios–like advanced lookup
functionality–that I’d address if I was inventing a Web framework.

I’ve been re-reading the Agile Rails book but couldn’t find a discussion
of search functionality (“search” also isn’t listed in the index).

I’m sure people are building search functionality and I’m just missing
something!


#2

Mike wrote:

Hello,

How do you handle advanced searches in Rails, i.e., anything more than
one field?

find_all_by_fielda_and_fieldb(vala,valb) will do it.

If it’s more complex, you can use:
find(:all, :conditions => [‘foo=? and bar!=?’, [vala, valb]])


#3

Hey Alex,

Thanks. I may be making this more complicated than it needs to be in
Rails.


#4

I’m a newbie but I think that is what Ferret is for.

On 1/27/06, Mike removed_email_address@domain.invalid wrote:

removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Greg F.
The Norcross Group
Forensics for the 21st Century