Ruby on Rails latest stable (v5.2.3) - 2 notes - Class: ActiveRecord::Relation
update(id = :all, attributes) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
July 27, 2011 - (>= v3.0.0)
0 thanks

Multiple update, on query ?

Person.update(people.keys, people.values)

Will this request issue one or multiple queries to update the table data (as in http://stackoverflow.com/questions/3432/multiple-updates-in-mysql#3466 )

The answer is: it will do TWO queries per updated row. One select and one update.

November 30, 2012
0 thanks

Beware: virtual attributes are ignored

Even though validations are called, virtual attributes are ignored.