scinote-web/db/migrate/20160809074757_update_my_module_coordinate.rb

12 lines
233 B
Ruby
Raw Normal View History

class UpdateMyModuleCoordinate < ActiveRecord::Migration
2016-08-10 14:49:18 +08:00
def change
2016-08-31 17:46:27 +08:00
MyModule.find_each do |my_module|
2016-08-10 14:49:18 +08:00
x = my_module.x
y = my_module.y
x *= 32
y *= 16
2016-08-31 17:46:27 +08:00
my_module.update(x: x, y: y)
2016-08-10 14:49:18 +08:00
end
end
end