Rails 3 + activerecord, the best way to "mass update" a single field for all the records that meet a condition -
in rails 3, using activerecord, there single-query way set :hidden field true records meet condition ... say, example, :condition => [ "phonenum = ?", some_phone_number ]
if single query cannot it, optimal approach?
use update_all optional second parameter condition:
model.update_all({ hidden: true }, { phonenum: some_phone_number})
Comments
Post a Comment