由网友(游戏上的学霸)分享简介:在轨道3,使用ActiveRecord的,有没有一个单一的查询方法来设置:隐藏字段为 TRUE 作为所有符合条件的记录...发言权例如,:条件=> [PHONENUM =?,some_phone_number] In rails 3, using activerecord, is there a single...
在轨道3,使用ActiveRecord的,有没有一个单一的查询方法来设置:隐藏字段为 TRUE 作为所有符合条件的记录...发言权例如,:条件=> [PHONENUM =?,some_phone_number]
In rails 3, using activerecord, is there a single-query way to set the :hidden field to TRUE for all records that meet a condition ... say, for example, :condition => [ "phonenum = ?", some_phone_number ]
如果一个查询不能做到这一点,什么是最佳的方法呢?
If a single query cannot do it, what IS the optimal approach?
推荐答案
使用 update_all
.update_all( {:hidden => true}, {:phonenum => some_phone_number} )
相关推荐
最新文章