我需要在 ActiveAdmin 中添加按字符串搜索。就像是:
ActiveAdmin.register Comment do
filter :post_title, as: :string
end
Run Code Online (Sandbox Code Playgroud)
如果我有这样的关联:
class Comment < ActiveRecord::Base
belongs_to :commentable, polymorphic: true
end
class Post < ActiveRecord::Base
belongs_to :content, polymorphic: true
has_many :comments, as: :commentable
end
Run Code Online (Sandbox Code Playgroud)
如果我有两个多态关联,我该怎么做?有必要创建自定义过滤器吗?