Posted almost 8 years ago. Visible to the public. Repeats.

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.

Owner of this card:

Last edit:
almost 4 years ago
by konjoot
ActiveRecord, Rails4
Posted by konjoot to wiki
This website uses short-lived cookies to improve usability.
Accept or learn more