ActiveRecord.update_each / updated_each!

What do you think about adding update_each and update_each! to ActiveRecord?

Basically it would make it easier to switch from update_all but triggering the callbacks (and could be later optimized, where each { |m| m.update(...) } is very difficult to optimize from the Rails-side.

A simple implementation could be:


class ActiveRecord::Base

def self.update_each(updates)

find_each { |model| model.update(updates) }

end

def self.update_each!(updates)

find_each { |model| model.update!(updates) }

end

end