Forum: Ruby on Rails how to save one value into the attributes of all rows in a model

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0bdaf2a5cf0a401d2ee4377b9ce47581?d=identicon&s=25 Tyl Tan (tyanlion)
on 2009-04-09 09:56
(Received via mailing list)
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.
5772c599ccab3081e0fffb1d54f3b6de?d=identicon&s=25 Andrew Timberlake (andrewtimberlake)
on 2009-04-09 10:11
(Received via mailing list)
On Thu, Apr 9, 2009 at 9:55 AM, tyliong <tyliong@gmail.com> 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/Ba...

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain
This topic is locked and can not be replied to.