Right now I am using Rails AR methods to update a bunch of attributes in a table.
RaceWeek.current_week.each { |r| r.update_attributes(:games_won => 0, :games_lost => 0) }
I’d prefer to do this more efficiently in a single transaction. How can this be done?
Use
update_all:Ps. Use some form of the above, because I do not know what the relation of
RaceWeektocurrent_weekis.Also see some examples