2

我有一个 postgres 枚举create_enum(:status_type, %i[requested approved])。我在一个带有status_type :status, null: false.

我正在尝试像这样在红宝石中包含包含在内进行过滤root.where(requests[:status].in(*values)values是一个字符串数组。

此代码返回以下错误: Dry::Types::ConstraintError: ["requested"] violates constraints (included_in?(["requested", "approved"], ["requested"]) failed)

如果我通过平等过滤它,它可以正常工作。root.where(requests[:status].is('requested')

您知道我在自定义类型列中包含包含过滤的方法吗?

4

0 回答 0