From b00a298c02df8ab68e18bc107e41ce35533e1af1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Sun, 6 Apr 2008 15:18:39 +0200 Subject: [PATCH] fix will_paginate for yet another Rails edge change (r9230) --- lib/will_paginate.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/will_paginate.rb b/lib/will_paginate.rb index de5f7d237..4a1c1720c 100644 --- a/lib/will_paginate.rb +++ b/lib/will_paginate.rb @@ -34,8 +34,13 @@ def enable_activerecord ActiveRecord::Base.class_eval { include Finder } # support pagination on associations - [ ActiveRecord::Associations::AssociationCollection, - ActiveRecord::Associations::HasManyThroughAssociation ].each do |klass| + a = ActiveRecord::Associations + returning([ a::AssociationCollection ]) { |classes| + # detect http://dev.rubyonrails.org/changeset/9230 + unless a::HasManyThroughAssociation.superclass == a::HasManyAssociation + classes << a::HasManyThroughAssociation + end + }.each do |klass| klass.class_eval do include Finder::ClassMethods alias_method_chain :method_missing, :paginate