:include brings back more records then I specify per page
-
Mislav
- State changed from new to invalid
It's because you're basically writing this:
MspLocation.all(...).paginate(...)You're first loading all the records, then paginating that array. Wrong? Yes.
The right way:
MspLocation.paginate(:page => 1, :include => {:msp_profile => :msp_services}, :joins => :msp_profile, :conditions => {:country => country}, :order => "company_name" )I don't think you need the ":joins" clause, too.
-
Brian
Thanks for the quick response. That makes sense. I'll update my code.
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.