Data base search with advanced options

How to approach this problem, i have a search form designed with
multiselect list, checkboxes and so on.

I need to combine all these things together for a sql query.
Let say the SQL from the options in the search form would be:

SELECT * FROM users WHERE (name LIKE ‘%value%’ OR surname LIKE
‘%value’ ) AND (account_type = 1 OR account_type=2) ORDER BY name ASC
LIMIT 2,20

So the old way would be to do a string go thrught the params and make
the sql above:
string = “SELECT * FROM users”
if params[:options]
string += " WHERE …"
if params …

#and then the


Is the a object oriented approach without tons of if else statements??