Vanilla Ruby with the postgres-pr adapter stores the 'numeric' datatype to BigDecimal. Unlike expected, the column has to explicitly define 'precision' and 'scale' when used in JRuby with the JDBC adapter, otherwise the scale is assumed to be 0 and all decimals are dropped. I have a column 'weight' in a table, in the original migration:
t.column :weight, :decimal, :null => false
This was corrected with the migration:
def self.up
change_column :weights, :weight, :decimal, :null => false, :precision => 4, :scale => 1
end
def self.down
change_column :weights, :weight, :decimal, :null => false
end
No comments:
Post a Comment