ruby-on-rails – RAILS精度和小数位数不起作用

我设置了:precision => 8,:scale => 2在十进制的迁移,但当我输入1923.423453它仍然是1923.4.它应该是1923.42 ……对吗?

t.decimal :value , :precision => 8, :scale => 2 , :default => 0

最佳答案 显然,迁移时会删除所有sqlite选项.

这是针对里程碑3.0.4的灯塔票,以解决此问题:
https://rails.lighthouseapp.com/projects/8994/tickets/2872-patch-sqlite3-adapter-drops-decimal-columns-precision-scale-when-migration-tries-to-alter-them

点赞