params[:name].downcase + '%' ],
Remove the first '%', it's a placeholder for an arbitrary string. I take
it, params[:id] was not what you intended to use.
Also, bear in mind that if you have a database index on the name column
it will most likely not be consulted as names are verbatim in the
index, not in lowercase. To make use of an index in a case like this,
the DBMS has to support functional indexes. MySQL apparently is too
dumb for it, but PostgreSQL has this feature.