From adef5d8aa11e916061063f66c629860f813e252f Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 21 Feb 2011 02:27:40 +0900 Subject: [PATCH] prefer not to pollute AR::Base --- lib/kaminari/active_record_extension.rb | 3 ++- spec/models/default_per_page_spec.rb | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/kaminari/active_record_extension.rb b/lib/kaminari/active_record_extension.rb index cb8ea6e..6724df5 100644 --- a/lib/kaminari/active_record_extension.rb +++ b/lib/kaminari/active_record_extension.rb @@ -2,7 +2,6 @@ require File.join(File.dirname(__FILE__), 'active_record_relation_methods') module Kaminari module ActiveRecordExtension extend ActiveSupport::Concern - include Kaminari::ConfigurationMethods included do def self.inherited(kls) #:nodoc: # TERRIBLE HORRIBLE NO GOOD VERY BAD HACK: inheritable_attributes is not yet set here on AR 3.0 @@ -14,6 +13,8 @@ module Kaminari end kls.class_eval do + include Kaminari::ConfigurationMethods + # Fetch the values at the specified page number # Model.page(5) scope :page, Proc.new {|num| diff --git a/spec/models/default_per_page_spec.rb b/spec/models/default_per_page_spec.rb index 2a6e934..34d7af4 100644 --- a/spec/models/default_per_page_spec.rb +++ b/spec/models/default_per_page_spec.rb @@ -1,6 +1,11 @@ require File.expand_path('../spec_helper', File.dirname(__FILE__)) describe 'default per_page' do + describe 'AR::Base' do + subject { ActiveRecord::Base } + it { should_not respond_to :paginates_per } + end + subject { User.page 0 } context 'by default' do