Reputation: 23
I'm running Rails 3.1.1 using the mysql2 gem (v0.3.11). For some reason, when adding some decimal columns to a table, it produces integer fields. It does not give me any error, and the migration shows that decimal columns are being created. Has anyone else run into this problem? Here's a line from my migration:
add_column :tracks, :energy, :decimal, precision: 18
I don't usually run to StackOverflow but I really don't know where to look for the problem.
Upvotes: 1
Views: 830
Reputation: 1230
try adding :scale => x
(where x
is the number digits you need to the right of the decimal point) to the line in your migration.
Upvotes: 2