From 37cfe65688b936dc54cc75fca16cd66536ddb7bb Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Sat, 12 Sep 2020 12:32:06 -0700 Subject: [PATCH] migrate existing weight calculators --- db/migrate/20200912190210_update_weight_calculators.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/migrate/20200912190210_update_weight_calculators.rb diff --git a/db/migrate/20200912190210_update_weight_calculators.rb b/db/migrate/20200912190210_update_weight_calculators.rb new file mode 100644 index 0000000000..4ee5a0dfc0 --- /dev/null +++ b/db/migrate/20200912190210_update_weight_calculators.rb @@ -0,0 +1,10 @@ +class UpdateWeightCalculators < ActiveRecord::Migration + def change + Calculator::Weight.each { |calculator| + calculator.preferred_unit_from_list = 'kg' + calculator.preferred_per_unit = calculator.preferred_per_kg + calculator.preferences.delete(:preferred_per_kg) + calculator.save + } + end +end