diff options
author | lest <just.lest@gmail.com> | 2011-11-22 13:34:13 +0300 |
---|---|---|
committer | lest <just.lest@gmail.com> | 2011-11-22 13:34:13 +0300 |
commit | 5bcd119b8d9bb6d88c949956de1ce13c2673b877 (patch) | |
tree | e64669915cd38db390c4c0ceaf5f87428a36b533 /actionpack/lib/action_controller | |
parent | c6d6b28bb4e105fd0ae7a0ef3c7df4bc416bd397 (diff) | |
download | rails-5bcd119b8d9bb6d88c949956de1ce13c2673b877.tar.gz rails-5bcd119b8d9bb6d88c949956de1ce13c2673b877.tar.bz2 rails-5bcd119b8d9bb6d88c949956de1ce13c2673b877.zip |
move show_detailed_exceptions? to Rescue module
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/rescue.rb | 10 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index d5f150e7c9..125dbf6bb5 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -196,15 +196,10 @@ module ActionController @_request = request @_env = request.env @_env['action_controller.instance'] = self - @_env['action_dispatch.show_detailed_exceptions'] = show_detailed_exceptions? process(name) to_a end - def show_detailed_exceptions? - defined?(Rails.application) && Rails.application.config.consider_all_requests_local || request.local? - end - def to_a #:nodoc: response ? response.to_a : [status, headers, response_body] end diff --git a/actionpack/lib/action_controller/metal/rescue.rb b/actionpack/lib/action_controller/metal/rescue.rb index eb037aa1b0..736ff5b31c 100644 --- a/actionpack/lib/action_controller/metal/rescue.rb +++ b/actionpack/lib/action_controller/metal/rescue.rb @@ -3,6 +3,11 @@ module ActionController #:nodoc: extend ActiveSupport::Concern include ActiveSupport::Rescuable + included do + config_accessor :consider_all_requests_local + self.consider_all_requests_local = false if consider_all_requests_local.nil? + end + def rescue_with_handler(exception) if (exception.respond_to?(:original_exception) && (orig_exception = exception.original_exception) && @@ -12,10 +17,15 @@ module ActionController #:nodoc: super(exception) end + def show_detailed_exceptions? + consider_all_requests_local || request.local? + end + private def process_action(*args) super rescue Exception => exception + request.env['action_dispatch.show_detailed_exceptions'] = show_detailed_exceptions? rescue_with_handler(exception) || raise(exception) end end diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index f0c29825ba..de7b837ecc 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -21,6 +21,8 @@ module ActionController paths = app.config.paths options = app.config.action_controller + options.consider_all_requests_local ||= app.config.consider_all_requests_local + options.assets_dir ||= paths["public"].first options.javascripts_dir ||= paths["public/javascripts"].first options.stylesheets_dir ||= paths["public/stylesheets"].first |