Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Active admin multiple select filter

I'm looking to make a filter on my admin page for a user to show users who have both Subject_A and Subject_B.

Using the following line of code I've been able to filter for the users who have either Subject_A or Subject_B or both.

filter :universities, as: :select, multiple: true

Is there a way to create a filter using Active Admin to filter for users that only have both Subject_A and Subject_B?

like image 674
Conor Avatar asked Dec 14 '16 14:12

Conor


2 Answers

multiple: true never worked for me. The following did however:

filter :section, label: 'Category', 
  as: :select, input_html: { multiple: true }, 
  collection: User.categories
like image 191
Lloyd Watkin Avatar answered Sep 27 '22 23:09

Lloyd Watkin


You can try this:

filter :universities_and_universities, as: :select, multiple: true

This is not the perfect solution but it should works fine

like image 22
Norm212 Avatar answered Sep 27 '22 22:09

Norm212