抱歉我的英文。我遇到问题:如何将pg_search用于activeadmin?
我用:
activeadmin 1.0.0.pre
我试图这样做:
class User < ActiveRecord::Base
...
include PgSearch
pg_search_scope :search2, against: :name
ransacker :name,
formatter: proc { |e|
results = User.search2(e).map(&:id)
results.present? ? results : nil
}, splat_params: true do |parent|
parent.table[:id]
end
...
end
在ActiveAdmin中:
ActiveAdmin.register User do
...
filter :name_in, :as => :string, :label => 'Name'
...
end
这很有效,但是当我搜索记录时:
之前的 :
后: