Topic: Refactor to prevent an SQL query per record that needs updating
# This generates an SQL update per energysheet (use with care)
for energysheet in energysheets
energysheet.cached_sec = -1
Since each record is being updated to the same value is there a better way to do this in Rails?
I guess a single SQL statement would do the trick... I know of find_by_sql but nothing to execute an update SQL query.
Many thanks, AFM!