【发布时间】:2021-10-11 14:09:47
【问题描述】:
我有一个加密列 :amount 之后使用 Lockbox,我需要在我的控制器中求和。
目前,我有 -
transaction_controller.rb
@one_month_transactions_sum = transactions.where(transaction_date: 1.month.ago..Date.today).sum(:amount).abs()
这给了我错误 - PG::UndefinedColumn: ERROR: column "amount" does not exist LINE 1: SELECT SUM(amount) FROM "transactions" WHERE "transactions".... ,这是有道理的,因为我要求 rails 在我更改为密文的列上使用 PG SUM 函数。
如何将控制器级别的事务与加密列相加?
【问题讨论】:
标签: ruby-on-rails postgresql encryption