Model.update_all ''active = true'', ''your
conditions''
http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M000999
Cheers,
Yuri
On 6/3/07, mike
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> 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 :(
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--
Best regards,
Yuri Leikind
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---