tyliong
2009-Apr-09 07:55 UTC
how to save one value into the attributes of all rows in a model
When i use Model.all and i want to save this one value into all the rows of the model how do i do it without using a "for" loop. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Andrew Timberlake
2009-Apr-09 08:10 UTC
Re: how to save one value into the attributes of all rows in a model
On Thu, Apr 9, 2009 at 9:55 AM, tyliong <tyliong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > When i use Model.all and i want to save this one value into all the > rows of the model how do i do it without using a "for" loop. > > >Model.update_all - http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M002218 Andrew Timberlake http://ramblingsonrails.com http://www.linkedin.com/in/andrewtimberlake "I have never let my schooling interfere with my education" - Mark Twain --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---