mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
prefer not to pollute AR::Base
This commit is contained in:
parent
5b2c7f20b0
commit
adef5d8aa1
2 changed files with 7 additions and 1 deletions
|
@ -2,7 +2,6 @@ require File.join(File.dirname(__FILE__), 'active_record_relation_methods')
|
||||||
module Kaminari
|
module Kaminari
|
||||||
module ActiveRecordExtension
|
module ActiveRecordExtension
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
include Kaminari::ConfigurationMethods
|
|
||||||
included do
|
included do
|
||||||
def self.inherited(kls) #:nodoc:
|
def self.inherited(kls) #:nodoc:
|
||||||
# TERRIBLE HORRIBLE NO GOOD VERY BAD HACK: inheritable_attributes is not yet set here on AR 3.0
|
# 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
|
end
|
||||||
|
|
||||||
kls.class_eval do
|
kls.class_eval do
|
||||||
|
include Kaminari::ConfigurationMethods
|
||||||
|
|
||||||
# Fetch the values at the specified page number
|
# Fetch the values at the specified page number
|
||||||
# Model.page(5)
|
# Model.page(5)
|
||||||
scope :page, Proc.new {|num|
|
scope :page, Proc.new {|num|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
||||||
|
|
||||||
describe 'default per_page' do
|
describe 'default per_page' do
|
||||||
|
describe 'AR::Base' do
|
||||||
|
subject { ActiveRecord::Base }
|
||||||
|
it { should_not respond_to :paginates_per }
|
||||||
|
end
|
||||||
|
|
||||||
subject { User.page 0 }
|
subject { User.page 0 }
|
||||||
|
|
||||||
context 'by default' do
|
context 'by default' do
|
||||||
|
|
Loading…
Reference in a new issue