Rails migration add float point field with scale and precision

Posted Over 10 years ago. Visible to the public. Repeats.
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
Last edit
Almost 6 years ago
konjoot
Keywords
ActiveRecord, Rails4
Posted by konjoot to wiki (2013-12-20 12:56)