0
votes

I see that ActiveAdmin::Filters::ResourceExtension defines reset_filters!, but I don't know where this should be called. When I create new records in active admin, I want the filters to be reset.

Example: I have a Post model and Tag model. Posts have many Tags. When I create a new Tag and tag a Post with that new tag, the filter on the Posts ActiveAdmin page doesn't update - it just lists the tags that existed previously and does not include the new tag in the filters.

How do I do this?

1

1 Answers

5
votes

I assume that's because you have filters like this:

filter :foo, as: :select, collection: Foo.where(bar: 'baz')

But what you need is this:

filter :foo, as: :select, collection: proc{ Foo.where(bar: 'baz') }

Also, for posterity: https://github.com/gregbell/active_admin/issues/2465