i want display few stats on top of activeadmin index page.
let's have car model, color attribute , year of fabrication. on top of index page, want display count of red cars. want count reflect use of filters; if choose show cars built in 1995, want red car count change accordingly.
how can access filtered list? guessed existence of variable containing result of filter action, can't find it.
turns out can use variable collection
anywhere in index.
something working perfectly, , reflects state of filters:
index div "total: #{collection.count}" column :attribute1 column :attribute2 actions end
another way use ransack, this:
modelname.ransack(params[:q]).result
but useless query, call ransack again no reason.
inspiration found in this question.
Comments
Post a Comment