You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

15 lines
422 B

class CreateMileageRates < ActiveRecord::Migration[7.1]
def change
create_table :mileage_rates do |t|
t.integer :year, null: false, index: { unique: true }
t.decimal :rate_per_km, precision: 5, scale: 2, null: false
t.timestamps
end
[2024, 2025, 2026].each do |year|
MileageRate.create_or_find_by(year: year) do |rate|
rate.rate_per_km = 0.42
end
end
end
end