Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filter by string instead of select in ActiveAdmin

I have belongs_to and has_many assotiations between two models. By default, activeadmin using select input for it. But in my case, it's imposible - because I have a thousands items. When I trying change filter to

filter :item, as: :string

it says that

undefined method `item_id_contains' for #<MetaSearch::Searches::DeliveryTime:0x007fdd57f12db8>

What is the best way to do it right?

like image 975
Meliborn Avatar asked Apr 02 '13 23:04

Meliborn


1 Answers

ActiveAdmin uses MetaSearch, so you should be able to do

filter :items_<attribute>, as: :string

So in your case if the item has a name, you can do:

filter :items_name, as: :string
like image 74
Luís Ramalho Avatar answered Sep 29 '22 03:09

Luís Ramalho