Reputation: 1425
Some had posted similar question as mine. I tried the solution to most of them. Some say ActiveAdmin is using Metasearch and some say it's using ransack. I tried both methods. My activeadmin version is 1.0.0.pre4 and rails 4.2.6 Follwing is my code for the user based filter:
ActiveAdmin.register Equipment do
filter :user
end
This gives me a user
dropdown where I can select one of the user and it filters the result based on that user. Right now I have only 3 users so its fine. But in future it will grow to thousands. So instead I would like to have a contains
field, where I can enter user name and filter.
I tried changing to following:
filter :user, as: :string, label: 'User'
and also
filter :items_user, as: :string
Didn't work. Can somebody please tell me what am I missing?
Upvotes: 0
Views: 1055
Reputation: 2659
Try this,
filter :user_name, as: :string
where name
is attribute of User Model.
Upvotes: 1