From 70071d2a81634e6168baf5ce0463b867645d62a0 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Thu, 30 Jun 2016 16:51:05 +0900 Subject: [PATCH] Move Action View extension code to kaminari-actionview gem --- kaminari-actionview/lib/kaminari/actionview.rb | 1 + .../kaminari/actionview}/action_view_extension.rb | 0 .../lib/kaminari/actionview/railtie.rb | 12 ++++++++++++ lib/kaminari/hooks.rb | 5 ----- 4 files changed, 13 insertions(+), 5 deletions(-) rename {lib/kaminari/helpers => kaminari-actionview/lib/kaminari/actionview}/action_view_extension.rb (100%) create mode 100644 kaminari-actionview/lib/kaminari/actionview/railtie.rb diff --git a/kaminari-actionview/lib/kaminari/actionview.rb b/kaminari-actionview/lib/kaminari/actionview.rb index b8c71a3..82d64a1 100644 --- a/kaminari-actionview/lib/kaminari/actionview.rb +++ b/kaminari-actionview/lib/kaminari/actionview.rb @@ -1,4 +1,5 @@ require "kaminari/actionview/version" +require 'kaminari/actionview/railtie' module Kaminari module Actionview diff --git a/lib/kaminari/helpers/action_view_extension.rb b/kaminari-actionview/lib/kaminari/actionview/action_view_extension.rb similarity index 100% rename from lib/kaminari/helpers/action_view_extension.rb rename to kaminari-actionview/lib/kaminari/actionview/action_view_extension.rb diff --git a/kaminari-actionview/lib/kaminari/actionview/railtie.rb b/kaminari-actionview/lib/kaminari/actionview/railtie.rb new file mode 100644 index 0000000..535e126 --- /dev/null +++ b/kaminari-actionview/lib/kaminari/actionview/railtie.rb @@ -0,0 +1,12 @@ +module Kaminari + module ActionView + class Railtie < ::Rails::Railtie #:nodoc: + initializer 'kaminari-actionview' do + ActiveSupport.on_load :action_view do + require 'kaminari/actionview/action_view_extension' + ::ActionView::Base.send :include, Kaminari::ActionViewExtension + end + end + end + end +end diff --git a/lib/kaminari/hooks.rb b/lib/kaminari/hooks.rb index 9da4eb6..79c9a20 100644 --- a/lib/kaminari/hooks.rb +++ b/lib/kaminari/hooks.rb @@ -7,11 +7,6 @@ module Kaminari end require 'kaminari/models/array_extension' - - ActiveSupport.on_load(:action_view) do - require 'kaminari/helpers/action_view_extension' - ::ActionView::Base.send :include, Kaminari::ActionViewExtension - end end end end