Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix handling InvalidPage exceptions in Rails 3.2

  • Loading branch information...
commit 6f4390b78af7fcc9259879ab3716acdc4eede4ba 1 parent f23551e
@mislav mislav authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/will_paginate/railtie.rb
View
6 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))
Please sign in to comment.
Something went wrong with that request. Please try again.