【发布时间】:2016-01-21 11:24:56
【问题描述】:
我正在尝试使用 Ransack 进行搜索,但是当我尝试将 id 和字符串一起搜索时遇到问题
:id_or_title_or_user_username_cont
它会产生错误
ActionView::Template::Error (PG::UndefinedFunction: ERROR: operator does not exist: integer ~~* integer
这个我也试过了
:id_eq_or_title_or_user_username_cont
它会产生以下错误
用于 Ransack::Search 的未定义方法 `id_eq_or_title_or_user_username_cont'
除了自定义谓词或自定义谓词之外,使用 ransack 一起搜索 id 和字符串的适当方法是什么?
【问题讨论】:
-
可能的解决方案已添加到 ransack wiki github.com/activerecord-hackery/ransack/wiki/…
标签: ruby-on-rails ruby ransack predicates