Permalink
Browse files

Rails3.1 is now supported w/ CollectionAssociation

AssociationCollection was functionally renamed to CollectionAssociation.
WillPaginate can now detect the proper class name and works on both
Rails 3.1 and earlier versions.
  • Loading branch information...
1 parent f169dcc commit e97acba1b94f2a6d19d5a271ddfa5ebc80d3d822 @JackDanger committed Apr 17, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/will_paginate.rb
View
5 lib/will_paginate.rb
@@ -36,7 +36,10 @@ def enable_activerecord
# support pagination on associations
a = ActiveRecord::Associations
- [ a::AssociationCollection ].tap { |classes|
+ [ a.const_defined?('CollectionAssociation') ?
+ a::CollectionAssociation :
+ a::AssociationCollection
+ ].tap { |classes|
# detect http://dev.rubyonrails.org/changeset/9230
unless a::HasManyThroughAssociation.superclass == a::HasManyAssociation
classes << a::HasManyThroughAssociation

0 comments on commit e97acba

Please sign in to comment.