will_paginate causing SystemStackError on has_many :through associations
-
E. James O'Kelly
I am experiencing the same result. Here is my pagination code that throws the issue. It is when dealing with a model that has a has_many :through association proxy. If you attempt to access that collection it throws the stack too deep exception in finder.rb of will_paginate.
class Mentor < User has_many :mentor_specialties, :dependent => :destroy has_many :specialties, :through => :mentor_specialties def self.page(page) paginate :include => [:specialties], :page => page, :per_page => 9 end def self.search(specialty, page) if specialty.blank? paginate :include => [:specialties], :page => page, :per_page => 9 else Mentor.find(:all, :include => [:mentor_specialties, :specialties], :conditions => ["mentor_specialties.specialty_id = ?", Specialty.find(specialty)]).paginate :page => page, :per_page => 9 end end endYou will notice this class inherits from another class that handles the activerecord, this is just an sti subclass.
-
Patrick
The latest checkout from Github (2.3.1) fixes this problem: http://github.com/mislav/will_pa...
Thanks guys!!
-
Mislav
- State changed from new to resolved
- Assigned user changed from Chris Wanstrath to Mislav
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.