In my project I have to write a search controller, in which I have to search for a string on multiple fields across joined tables.
There are two controllers Project, Publication and two modles projects and publications.
Project has many publication and publication belongs to project.
I wanted to search for a string on all fields of project and publications. For that I wrote a query in which I have to mention all the fields on which I wanted to search.
This was fine, but after some days I found a plugin: TextSearch. This changed the whole stuff.
This is a very useful plugin for search and you should try this.
For more detail please visit http://wiki.rubyonrails.org/rails/pages/TextSearch