Forum: Ruby on Rails Search/advanced search

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.
Mike (Guest)
on 2006-01-27 18:54
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!
Alex Y. (Guest)
on 2006-01-27 19:00
(Received via mailing list)
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]])
Mike (Guest)
on 2006-01-27 19:30
Hey Alex,

Thanks. I may be making this more complicated than it needs to be in
Rails.
Greg F. (Guest)
on 2006-01-28 01:42
(Received via mailing list)
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
This topic is locked and can not be replied to.