I have a query that I am trying to paginate where I am passing an array of user ids. Here is a simplified example:
@rounds = Round.paginate_by_user_id(
[1,2,3],
:page => page,
:order => 'date_played desc'
)
Basically, I want to return a list of all the Round object for users 1, 2, and 3. As far as the find part, this works as expected and generates the sql with a where clause that looks like:
where user_id in (1, 2, 3)
When I call:
@rounds.total_entries
I get back 3 even though there are 50+ Round object actually returned. Digging into the will_paginate code, I found the line:
total_entries ||= (Array === args.first and args.first.size)
in:
method_missing_with_paginate
So it looks like anytime an array is passed as a first arg, the size is taken from the array. I can understand why that is being done (to support paginating arrays) but I guess there is a legit use for array args being passed to finder calls as well.