1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

Move Active Record extension code to kaminari-activerecord gem

This commit is contained in:
Akira Matsuda 2016-06-30 19:38:53 +09:00
parent 427d8fa1a5
commit 18b6b50c99
6 changed files with 15 additions and 7 deletions

View file

@ -1,4 +1,5 @@
require "kaminari/activerecord/version"
require 'kaminari/activerecord/railtie'
module Kaminari
module Activerecord

View file

@ -1,4 +1,4 @@
require 'kaminari/models/active_record_model_extension'
require 'kaminari/activerecord/active_record_model_extension'
module Kaminari
module ActiveRecordExtension

View file

@ -1,4 +1,4 @@
require 'kaminari/models/active_record_relation_methods'
require 'kaminari/activerecord/active_record_relation_methods'
module Kaminari
module ActiveRecordModelExtension

View file

@ -0,0 +1,12 @@
module Kaminari
module ActiveRecord
class Railtie < ::Rails::Railtie #:nodoc:
initializer 'kaminari-activerecord' do
ActiveSupport.on_load :active_record do
require 'kaminari/activerecord/active_record_extension'
::ActiveRecord::Base.send :include, Kaminari::ActiveRecordExtension
end
end
end
end
end

View file

@ -1,11 +1,6 @@
module Kaminari
class Hooks
def self.init
ActiveSupport.on_load(:active_record) do
require 'kaminari/models/active_record_extension'
::ActiveRecord::Base.send :include, Kaminari::ActiveRecordExtension
end
require 'kaminari/models/array_extension'
end
end