app/controllers/wallaby/application_controller.rb in wallaby-5.1.3 vs app/controllers/wallaby/application_controller.rb in wallaby-5.1.4
- old
+ new
@@ -6,16 +6,14 @@
class ApplicationController < configuration.base_controller
helper ApplicationHelper
ERROR_PATH = ERROR_LAYOUT = 'wallaby/error'.freeze
- # NOTE: we want to see the error blown up in development environment
- unless Rails.env.development?
- rescue_from NotFound, with: :not_found
- rescue_from ::ActionController::ParameterMissing, with: :bad_request
- rescue_from ::ActiveRecord::StatementInvalid, with: :unprocessable_entity
- end
+ rescue_from NotFound, with: :not_found
+ rescue_from ::ActionController::ParameterMissing, with: :bad_request
+ rescue_from ::ActiveRecord::StatementInvalid, with: :unprocessable_entity
+ rescue_from UnprocessableEntity, with: :unprocessable_entity
layout 'wallaby/application'
# Not found page
def not_found(exception = nil)
@@ -31,9 +29,15 @@
def unprocessable_entity(exception = nil)
error_rendering(exception, __callee__)
end
protected
+
+ # @see https://github.com/rails/rails/blob/5-0-stable/actionpack/lib/action_controller/metal/helpers.rb#L118
+ # `helpers` exists since Rails 5, need to replicate this for Rails 4.2
+ def helpers
+ @helpers ||= defined?(super) ? super : view_context
+ end
def configuration
::Wallaby.configuration
end