Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use autoloading in Railtie so that framework loading isn't triggered …

…by will_paginate
  • Loading branch information...
commit 35216e2d515db2ed2923ac6a611059522d1da2d9 1 parent 3615938
@matthuhiggins matthuhiggins authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/will_paginate/railtie.rb
View
10 lib/will_paginate/railtie.rb
@@ -4,21 +4,23 @@
module WillPaginate
class Railtie < Rails::Railtie
initializer "will_paginate.active_record" do |app|
- if defined? ::ActiveRecord
+ ActiveSupport.on_load :active_record do
require 'will_paginate/finders/active_record'
WillPaginate::Finders::ActiveRecord.enable!
end
end
initializer "will_paginate.action_dispatch" do |app|
- if defined? ::ActionDispatch::ShowExceptions
+ ActiveSupport.on_load :action_controller do
ActionDispatch::ShowExceptions.rescue_responses['WillPaginate::InvalidPage'] = :not_found
end
end
initializer "will_paginate.action_view" do |app|
- require 'will_paginate/view_helpers/action_view'
- ActionView::Base.send(:include, WillPaginate::ViewHelpers::ActionView)
+ ActiveSupport.on_load :action_view do
+ require 'will_paginate/view_helpers/action_view'
+ include WillPaginate::ViewHelpers::ActionView
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.