mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
migrate existing weight calculators
This commit is contained in:
10
db/migrate/20200912190210_update_weight_calculators.rb
Normal file
10
db/migrate/20200912190210_update_weight_calculators.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user