views:

28

answers:

1

I've started using the metasearch gem http://metautonomo.us/projects/metasearch/ for a ruby on rails 3 app after seeing it recommended in another stackoverflow post. I would like to have a single text field on a search form that can search in multiple fields rather than have one text field for each. I just havn't been able to figure it out.

My example below is probably a little more complicated because it also uses Multi-level associations:

Model: Report belongs to site

Model: Site has many reports

View (the index for reports with a search form):

Have something like:

<%= f.text_field :site_name_or_site_address_contains %>

rather than 2 seperate text fields like:

<%= f.text_field :site_name_contains %> <%= f.text_field :site_address_contains %>

The notes on the website and rdocs cover adding new where statements in the initializer. I'm not sure if thats required but I don't really understand them either.

A: 

Hey Daniel,

Check out the latest version on GitHub: http://github.com/ernie/meta_search

I've held off on adding that support for a while because I think the syntax gets a bit goofy looking. You might want to check out the support for custom search methods, as well.

Ernie
Thanks heaps for the update Ernie. It works really well, just the way I was hoping it would. I'll take a look at those custom search methods too.
Daniel