I’m creating some form to filter my users, table User and I’m discovering the joys of ActiveRecord.
-
Userhasnameandfunctioncolumns. -
Userhas manyAddress -
Addresshascountryandtowncolumns. -
Userhas manyHobby -
Hobbyhas acategorycolumn.
In my params I have name, function, country, town and category.
I basically want to get all Users who match at least one of these params (OR condition, I use a MySQL database).
Thanks in advance.
I copy some code below to let you see what I expected.
The query is built with
ORand emptyparamsare not included (neither their values, nor the join).