From 3c567d246b589066bfc6225d9c0437839bc0d6b9 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 18 Feb 2011 08:09:53 +0900 Subject: [PATCH] avoid possible namespace collision --- .../{active_record.rb => active_record_extension.rb} | 4 ++-- lib/kaminari/{mongoid.rb => mongoid_extension.rb} | 4 ++-- lib/kaminari/railtie.rb | 10 +++++----- spec/models/scopes_spec.rb | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) rename lib/kaminari/{active_record.rb => active_record_extension.rb} (94%) rename lib/kaminari/{mongoid.rb => mongoid_extension.rb} (93%) diff --git a/lib/kaminari/active_record.rb b/lib/kaminari/active_record_extension.rb similarity index 94% rename from lib/kaminari/active_record.rb rename to lib/kaminari/active_record_extension.rb index ecfa271..08d2d84 100644 --- a/lib/kaminari/active_record.rb +++ b/lib/kaminari/active_record_extension.rb @@ -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 paginates_per def self.default_per_page - @_default_per_page || Kaminari::ActiveRecord::DEFAULT_PER_PAGE + @_default_per_page || Kaminari::ActiveRecordExtension::DEFAULT_PER_PAGE end end end diff --git a/lib/kaminari/mongoid.rb b/lib/kaminari/mongoid_extension.rb similarity index 93% rename from lib/kaminari/mongoid.rb rename to lib/kaminari/mongoid_extension.rb index dd5b677..a1b2828 100644 --- a/lib/kaminari/mongoid.rb +++ b/lib/kaminari/mongoid_extension.rb @@ -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 paginates_per def self.default_per_page - @_default_per_page || Kaminari::Mongoid::DEFAULT_PER_PAGE + @_default_per_page || Kaminari::MongoidExtension::DEFAULT_PER_PAGE end end end diff --git a/lib/kaminari/railtie.rb b/lib/kaminari/railtie.rb index 16b3ecc..286d149 100644 --- a/lib/kaminari/railtie.rb +++ b/lib/kaminari/railtie.rb @@ -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 diff --git a/spec/models/scopes_spec.rb b/spec/models/scopes_spec.rb index 2f73c43..728ff39 100644 --- a/spec/models/scopes_spec.rb +++ b/spec/models/scopes_spec.rb @@ -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}" }