I wonder if anyone can give me some direction.
I’m trying to figure out how to handle pagination when I have a very
complex way of building up a collection of objects. I’ve used the old
classic pagination before, and I’ve used will_paginate, but I don’t
think either will work in my case.
Briefly, I have a Location model that defines a physical location. I
then build up a list of @locations by a variety of “filters”… for
example, a text-based search query plus a geolocation radial search,
plus one or more category selections. Underneath the hood, these are
each separate queries that build a list of location objects. I then
merge the results into a single instance variable: @locations, which
is the array of matched Location objects.
Now, I wanna paginate that.
I suppose one option might be for me to try and build the thing into a
single, monster SQL query that I can then add some LIMIT fields to…
but for now, let’s assume that’s not an option. (I shiver at the
complexity of it. oy!)
So… is there anything I can do with an existing set? Can
will_paginate support that? (I’m thinking no, but I figured I’d ask).
I think the classic_pagination plugin can, but I’m not really sure