Browse files

fix busted mixing in ActiveRecord

  • Loading branch information...
1 parent 37b5bfa commit aca3794b7f2f3e1b06f8b17634b8d94c3ccf5c68 @mislav committed Feb 5, 2010
Showing with 6 additions and 4 deletions.
  1. +4 −4 lib/will_paginate/finders/active_record.rb
  2. +2 −0 spec/finders/active_record_spec.rb
View
8 lib/will_paginate/finders/active_record.rb
@@ -28,13 +28,13 @@ module ActiveRecord
# In Rails, this is automatically called to mix-in pagination functionality to ActiveRecord.
def self.enable!
- ActiveRecord::Base.class_eval do
- extend self
+ ::ActiveRecord::Base.class_eval do
+ extend ActiveRecord
end
# support pagination on associations and scopes
- [ActiveRecord::Relation, ActiveRecord::Associations::AssociationCollection].each do |klass|
- klass.send(:include, self)
+ [::ActiveRecord::Relation, ::ActiveRecord::Associations::AssociationCollection].each do |klass|
+ klass.send(:include, ActiveRecord)
end
end
View
2 spec/finders/active_record_spec.rb
@@ -3,6 +3,8 @@
require File.expand_path('../activerecord_test_connector', __FILE__)
ActiverecordTestConnector.setup
+WillPaginate::Finders::ActiveRecord.enable!
+
describe WillPaginate::Finders::ActiveRecord do
extend ActiverecordTestConnector::FixtureSetup

0 comments on commit aca3794

Please sign in to comment.