Modernise use of find and update_all in database migrations

This commit is contained in:
Tom Hughes 2014-04-25 00:41:39 +01:00
parent 1a38e9b315
commit 360333d37d
6 changed files with 13 additions and 13 deletions

View file

@ -9,7 +9,7 @@ class TileTracepoints < ActiveRecord::Migration
if ENV["USE_DB_FUNCTIONS"]
Tracepoint.update_all("latitude = latitude * 10, longitude = longitude * 10, tile = tile_for_point(latitude * 10, longitude * 10)")
else
Tracepoint.find(:all).each do |tp|
Tracepoint.all.each do |tp|
tp.latitude = tp.latitude * 10
tp.longitude = tp.longitude * 10
tp.save!