9

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?

Meliborn
  • 6,495
  • 6
  • 34
  • 53

2 Answers2

21

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
Luís Ramalho
  • 10,018
  • 4
  • 52
  • 67
  • Isn't metasearch anymore, it's using Ransack(https://github.com/activerecord-hackery/ransack) but the answe is still valid. Thanks. – lucianosousa Aug 03 '15 at 14:46
0

Refer relation of models and the following code

table = users id, name, email

table = customers id, name, user_id

user has_many customers

customer belongs user

USE filter :user_name, as: :string instead of filter :user

Snm Maurya
  • 1,085
  • 10
  • 12