#264 open
Blane Dabney

Incorrect counts when using rails 2.3 :having option and scopes

Reported by Blane Dabney | March 3rd, 2009 @ 07:07 PM

I'm using rails 2.3 and have a named_scope that uses the :having option to filter results based on joined aggregate data. When using will_paginate with this, the :having (and :group) options from the scope are not passed through to the count method, so the page count it calculates is inaccurate. I have attached the patch I made to resolve this. It probably needs some work but it resolved my immediate need. It basically ensures that the :having and :group options are pulled from the scope and ONLY if they weren't explicity defined when calling paginate.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Everyone's favorite Ruby library for pagination of practically anything!

People watching this ticket

Attachments

Referenced by

Pages