【发布时间】:2018-03-17 18:48:40
【问题描述】:
我有一个名为 InfoData 的 Rails 模型,它有一个名为 error_codes 的属性。代码存储在数组中,如 [9,7,10,21] (integer[]) .
回顾一下
InfoData.first.error_codes
=> [9,7,5]
我尝试对其使用 ransack 以搜索是否存在特定代码(通过选择选项)。对于 error_codes_in (_in ransack predicate) 我收到以下错误
operator does not exist: integer[] = integer
LINE 1: ...ranch_id" WHERE "info_data"."error_codes" IN (9) A...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
应该如何解决?
【问题讨论】:
标签: sql ruby-on-rails ruby activerecord ransack