我需要能够在字符串过滤器中搜索ActiveAdmin 0.4.0的多个术语。
e.g。
filter :city, :as => :string
如何更改此设置以便能够搜索“纽约”或“洛杉矶”或“底特律”等字词?
答案 0 :(得分:1)
你想要那个:
filter :city, :as => :string, :match => 'New York', :or => :match => 'Los Angeles', :or => :match => 'Detroit'
‘match’ will check if a field, when turned into a string, matches a given regular expression.
‘smatch’ works the same but only accepts fields that are strings.
更多信息here