I have an ajax powered live search that currently works off of a text
field. I pass the
contents of the text field inside of @params[''search''] to the
controller
which then gathers up all the
servicerequests which contain the string in the "problem" field.
@servicerequests = Servicerequest.find( :all, :order_by => ''opened
DESC'',
:conditions => [ ''LOWER(problem) LIKE
?'',
''%'' + @params[''search''].downcase +
''%'' ])
Is there an easy way to look for this string everywhere in the
servicerequest table?
I want to look in fields besides "problem" but I don''t know
how to add
those to the query(my SQL is weak right now).
Also I would also like to look for the same string in a table that the
servicerequest
"belongs_to". Specifically I have a user table, each servicerequest
belongs_to a user,
and I want to be able to search inside of the user''s name and address
and so on.
How would I do this?
Thank you,
Matthew Margolis