Return 金钱 (ruby) 的结果与比较(例如超过 x 的物品)

Return results from money (ruby) with a comparison (e.g. items more than x)

很简单的一个。

我想做以下事情

Model.where("money_rate > ?", some_other_money_item)

有什么想法吗?

PG::UndefinedColumn: ERROR:  column "money_rate" does not exist
LINE 1: SELECT "jobs".* FROM "jobs"  WHERE (money_rate > '--- !ruby/...etc

似乎只能使用基本方法进行比较,在上述情况下,这将是 money_rate_cents

所以:

Model.where("money_rate_cents > ?", some_other_money_item_in_cents)

Returns货币属性较高的物品数组

如果其他人觉得它有用,就会留下它。或者万一我遗漏了什么,你可以对整个数字进行比较。