Reputation: 6645
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?
Upvotes: 9
Views: 4098
Reputation: 1155
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
Upvotes: 0
Reputation: 10208
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
Upvotes: 21