Forum: Ruby on Rails update a lot of objects

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Aa9c8aff95b1d8eb91ba15adc3e42802?d=identicon&s=25 mike (Guest)
on 2007-06-03 21:49
can i update in one query a group of objects? i've something like: objs
= Model.find(:all, :conditions => ....)...can i do something like
objs.update_attribute(:active, true) ?
i can't do a objs.each do |obj| obj.update_attribute
because it's in a script which run every 5 minutes....and N could be 1
as could be 10000 :(
8d1e089fd6a6703f5f13dbee271aa77c?d=identicon&s=25 Yuri Leikind (Guest)
on 2007-06-03 23:02
(Received via mailing list)
Model.update_all 'active = true', 'your conditions'


On 6/3/07, mike <> wrote:
> >

Best regards,
Yuri Leikind
This topic is locked and can not be replied to.