Alexey Chernikov
Alexey Chernikov

Reputation: 1875

Is it possible to access full index scope at sidebar in activeadmin?

I have created ActiveAdmin administration interface for Bill model in my application, and want to display statistic information in sidebar on index and filtered searches (like total amount of current filtered bills). In sidebar seaction I have access to bills relation like that:

sidebar do
  bills.sum(:amount)
end

bills correctly scoped with current filters: date, number etc.

But 'bills' relation contains only 30 records (which displayed on page, 30 is default pagination size), but in total it's more than 300. How can I get "unpaged" relation for current filtered bills (with current selected filters)?

Upvotes: 2

Views: 361

Answers (1)

Alexey Chernikov
Alexey Chernikov

Reputation: 1875

Get it myself, I can use bills.limit(nil), which override current page selection in relation, and returns full scope.

Upvotes: 3

Related Questions