I have two classes Site and Servicerequest.
Site has_many Servicerequests
and
Servicerequest belongs_to Site
I have a search box where the user can type in a string to be searched
for in a Servicerequest. This works just fine as in the controller I
can just do something like
@servicerequests = Servicerequest.find( :all, :order_by => ''opened
DESC'',
:conditions => [ ''LOWER(problem) LIKE ?'',
''%'' +
@params[''search''].downcase + ''%'' ])
and then render the returned Servicerequests
However, this approach does not work if I want to search for all
Servicerequests that have the search string inside of their
corresponding Site object. How can I do a search that will return all
servicerequests that have Sites that have their name fields set to
"Jon"?
Thank you,
Matthew Margolis