Permalink
Browse files

fix handling InvalidPage exceptions in Rails 3.2

  • Loading branch information...
1 parent f23551e commit 6f4390b78af7fcc9259879ab3716acdc4eede4ba @mislav committed Dec 20, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/will_paginate/railtie.rb
@@ -25,7 +25,9 @@ class Railtie < Rails::Railtie
end
def self.setup_actioncontroller
- ActionDispatch::ShowExceptions.send :include, ShowExceptionsPatch
+ ( defined?(ActionDispatch::ExceptionWrapper) ?
+ ActionDispatch::ExceptionWrapper : ActionDispatch::ShowExceptions
+ ).send :include, ShowExceptionsPatch
ActionController::Base.extend ControllerRescuePatch
end
@@ -39,7 +41,7 @@ module ShowExceptionsPatch
extend ActiveSupport::Concern
included { alias_method_chain :status_code, :paginate }
private
- def status_code_with_paginate(exception)
+ def status_code_with_paginate(exception = self.exception)
if exception.is_a?(WillPaginate::InvalidPage) or
(exception.respond_to?(:original_exception) &&
exception.original_exception.is_a?(WillPaginate::InvalidPage))

0 comments on commit 6f4390b

Please sign in to comment.