我已经构建了一个运行 rails 4.1 和 ruby 1.9.3 的应用程序,它使用了money-rails gem。当我在表单字段中输入较大的美元值并将它们保存到我的 PG 数据库时,我遇到了一个问题。错误如下:
PG::NumericValueOutOfRange: ERROR: value "9900000000" is out of range for type integer
PG 文档显示整数的最大值为 +2147483647。我希望能够使用 money-rails gem,但能够输入更大的数字。
就解决方案而言,我知道 PG 中的列类型应该是 bigint,但是我不知道如何使money-rails 支持将数字存储为 bigint 而不是整数。