Reputation: 126
I need to be able to search by multiple terms in a string filter for ActiveAdmin 0.4.0.
e.g.
filter :city, :as => :string
How can I change this to be able to search for terms such as 'New York' OR 'Los Angeles' OR 'Detroit' ?
Upvotes: 0
Views: 167
Reputation: 19
you want that:
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.
more info here
Upvotes: 1