I have a 'search' function where I want to pass in an arbitrary 'filter' condition and have matches returned
The following matches any name/email where the filter string is a match:
@people = Person.all
@people = @people.or(
{'name.first_name' => /#{filter}/i},
{'name.last_name' => /#{filter}/i},
{'email' => /#{filter}/i }
)
The following correctly does the same on the 'tags' array on the Person record:
@people = Person.all
@people = @people.any_in('tags' => [/#{filter}/i])
Can anyone tell me how to combine the two queries, so that a Person is matched if the filter text is found in the name, email or any of the tags?