I have a query update deals set count = count + 1
. In Rails, when I do this using ActiveRecord, I can think of
Deal.all.each { |deal| deal.update_attribute(:count => (deal.count + 1))}
and this take a lot more SQL queries instead of one query. Is there a better way to do this in Rails (not using the SQL query directly in the Rails app).