Passing variables with update_all


I’d like to produce an SQL update along the lines of:
UPDATE companies SET category2={newcategory} WHERE (category2 =

At the moment I’ve got:

ctype = params[:ctype]
Company.update_all(“category2=ctype”, “category2=ctype”)

At present this returns a StatementInvalid:
Unknown column ‘ctype’ in ‘where clause’: UPDATE companies SET
category2=ctype WHERE (category2 = ctype)

Can anyone tell me how I can pass the variable successfully?