The following Rails code results in 6 queries
people = { 1 => { "name" => "David" }, 2 => { "name" => "Jeremy" }, 3 => { "name" => "Tom" } }
Person.update(people.keys, people.values)
It will do TWO queries per updated row. One select and one update.
Is there a way to do the same task in Rails 4 with only one query (or only two queries)?
There are some information here on how to do it in MySQL, but not Rails: Multiple Updates in MySQL
Thanks.