Follow Along as I Stumble on the Path to Learning RoR

Changing Column to Add Precision and Scale

If you have to add precision and scale to a decimal field, here’s a sample migration:

 

class ChangeScale < ActiveRecord::Migration
def self.up
change_column :shirts, :price, :decimal, precision: 5, scale: 2
end

def self.down
change_column :shirts, :price, :decimal, :precision, :scale
end
end

Advertisements

Comments are closed.