gregbell/active_admin — Issue #982: HABTM Checkboxes Filtering Bug
Author: Lordnibbler
Created: 2012-02-06 06:58:24+00:00
State: open

I am designing a basic file manager (the Asset model) in the Active Admin gem. Each Asset HABTM Groups, and vice-versa.

In my active_admin Asset resource I have a filter where I want to be able to select multiple groups to filter by, so I added:

filter :groups_id, :as => :check_boxes, :collection => proc {Group.all}
All of the groups show up as checkboxes as expected. However, if I have asset_1, asset_2 and I have group_1 assigned to asset_1 and asset_2, and group_2 to asset_2, when I filter by both groups, asset_2 lists itself twice (three times if I add it to another group, and so on).

Is this a bug, or is there a way implemented that I am missing in the docs allowing us to restrict the filter so only "distinct" or "unique" assets are returned?