DECIMAL(M,D)
PRECISION (M)
/ \
1234567.123
\ /
SCALE (D)
M is the maximum number of digits (the precision). It has a range of 1 to 65. (Older versions of MySQL permitted a range of 1 to 254.)
D is the number of digits to the right of the decimal point (the scale). It has a range of 0 to 30 and must be no larger than M.
E.g.
DECIMAL(10,3) => 1234567.123
or in Rails speak
t.decimal :mycolumn, precision: 10, scale: 3 #=> 1234567.123
Confusingly number_to_percentage
takes :precision
option which specifies scale in the SQL speak.
Posted by Ev Dolzhenko to Ev's deck (2013-12-17 12:32)