mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
avoid possible namespace collision
This commit is contained in:
parent
65a1626f73
commit
3c567d246b
4 changed files with 10 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
module Kaminari
|
||||
module ActiveRecord
|
||||
module ActiveRecordExtension
|
||||
extend ActiveSupport::Concern
|
||||
DEFAULT_PER_PAGE = 25
|
||||
|
||||
|
@ -51,7 +51,7 @@ module Kaminari
|
|||
# This model's default per_page value
|
||||
# returns 25 unless explicitly overridden via <tt>paginates_per</tt>
|
||||
def self.default_per_page
|
||||
@_default_per_page || Kaminari::ActiveRecord::DEFAULT_PER_PAGE
|
||||
@_default_per_page || Kaminari::ActiveRecordExtension::DEFAULT_PER_PAGE
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
module Kaminari
|
||||
module Mongoid
|
||||
module MongoidExtension
|
||||
DEFAULT_PER_PAGE = 25
|
||||
|
||||
module Criteria
|
||||
|
@ -55,7 +55,7 @@ module Kaminari
|
|||
# This model's default per_page value
|
||||
# returns 25 unless explicitly overridden via <tt>paginates_per</tt>
|
||||
def self.default_per_page
|
||||
@_default_per_page || Kaminari::Mongoid::DEFAULT_PER_PAGE
|
||||
@_default_per_page || Kaminari::MongoidExtension::DEFAULT_PER_PAGE
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,13 +6,13 @@ module Kaminari
|
|||
class Railtie < ::Rails::Railtie #:nodoc:
|
||||
initializer 'paginatablize' do |app|
|
||||
if defined? ::ActiveRecord
|
||||
require File.join(File.dirname(__FILE__), 'active_record')
|
||||
::ActiveRecord::Base.send :include, Kaminari::ActiveRecord
|
||||
require File.join(File.dirname(__FILE__), 'active_record_extension')
|
||||
::ActiveRecord::Base.send :include, Kaminari::ActiveRecordExtension
|
||||
end
|
||||
if defined? ::Mongoid
|
||||
require File.join(File.dirname(__FILE__), 'mongoid')
|
||||
::Mongoid::Document.send :include, Kaminari::Mongoid::Document
|
||||
::Mongoid::Criteria.send :include, Kaminari::Mongoid::Criteria
|
||||
require File.join(File.dirname(__FILE__), 'mongoid_extension')
|
||||
::Mongoid::Document.send :include, Kaminari::MongoidExtension::Document
|
||||
::Mongoid::Criteria.send :include, Kaminari::MongoidExtension::Criteria
|
||||
end
|
||||
::ActionView::Base.send :include, Kaminari::Helpers
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require File.expand_path('../spec_helper', File.dirname(__FILE__))
|
||||
|
||||
describe Kaminari::ActiveRecord do
|
||||
describe Kaminari::ActiveRecordExtension do
|
||||
before :all do
|
||||
User.delete_all
|
||||
1.upto(100) {|i| User.create! :name => "user#{'%03d' % i}" }
|
||||
|
|
Loading…
Reference in a new issue