I was recently using ActiveAdmin and came up to a particular
case when the index page for a particular resource was loading
really slow. After trying to search up and down, trying to
figure out what was the issue, I finally found that the issue
was with a filter.
To explain it a little bit more clearly, let us suppose that
we have a particular case when you have a project in which a
Client has many Transactions and we have
hundreds of thousands of transactions. Now, due to the fact
that we have a client with so many transactions, getting all
these records each time you visit the index page of the Client
takes a lot of time. In the index page, you may have many
filters, in which a filter can be used to filter clients based
on the transactions. Due to the fact that we have so many
records, we can simply hide this filter, so that we are no
longer trying to filter clients based on the transactions. To
do that, we can simply write:
remove_filter :transactions
Now, we no longer have to
wait so long for the page of clients to load. You still can
filter transactions for different clients by having a
client filter inside the transactions’ index page.
You have considerably fewer clients and the transactions of
results are also paginated, so this should still give you a
way of filtering the results without having to compromise with
the loss of this filter.