Rails migration add float point field with scale and precision

class CreateFakes < ActiveRecord::Migration
  def change
    create_table :fakes do |t|
      t.decimal :float_value, :precision => 4, :scale => 3
    end
  end
end

This will allow you to have 3 digits after the decimal point and 4 digits max.

konjoot Over 10 years ago