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

12 lines
238 B
Ruby
Raw Normal View History

2017-06-30 16:23:28 +08:00
class UpdateMyModuleCoordinate < ActiveRecord::Migration[4.2]
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