I'm using Rails 2.1 and and will_paginate 2.3.2. I have the following models:
class Product < ActiveRecord::Base
has_many :product_audience_associations
has_many :audiences, :class_name => "ProductAudience", :through => :product_audience_associations
end
class ProductAudience < ActiveRecord::Base
has_many :product_audience_associations
has_many :products, :through => :product_audience_associations
end
class ProductAudienceAssociation < ActiveRecord::Base
belongs_to :product
belongs_to :audience, :class_name => "ProductAudience", :foreign_key => :product_audience_id
end
When I go to save a product record, I get the following error trace with the error message "stack level too deep":
/Library/WebServer/Websites/Thoratec/rails_thoratec_2/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:164 :in `method_missing_without_paginate'
/Library/WebServer/Websites/Thoratec/rails_thoratec_2/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:164 :in `method_missing'
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations.rb:1180 :in `validate_associated_records_for_audiences'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:173 :in `send'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:173 :in `evaluate_method'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:161 :in `call'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:90 :in `run'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:90 :in `each'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:90 :in `send'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:90 :in `run'
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/callbacks.rb:272 :in `run_callbacks'
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/validations.rb:929 :in `valid_without_callbacks?'
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:267 :in `valid?'
If I remove will_paginate, things work out... but, then I don't get to paginate with will_paginate, which makes me sad.