aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-15 19:43:49 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-15 19:43:49 +0100
commit26e7400cc5415dbce5e2c5d13da96ad8c25749e2 (patch)
tree956eceae5adddf3a1e7f1c5146d2cccf1aed27fa /actionpack
parent283a08763495a6b3ce0b196259ee1666f2b08cf1 (diff)
downloadrails-26e7400cc5415dbce5e2c5d13da96ad8c25749e2.tar.gz
rails-26e7400cc5415dbce5e2c5d13da96ad8c25749e2.tar.bz2
rails-26e7400cc5415dbce5e2c5d13da96ad8c25749e2.zip
Fix diagnostics page for routing errors.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG.md4
-rw-r--r--actionpack/lib/action_controller/metal/rescue.rb9
-rw-r--r--actionpack/lib/action_controller/railtie.rb2
-rw-r--r--actionpack/test/controller/show_exceptions_test.rb13
4 files changed, 14 insertions, 14 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index b354f05960..da18060202 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -68,9 +68,9 @@
<%= f.text_field :version %>
<% end %>
-* Refactor ActionDispatch::ShowExceptions. Controller is responsible for choice to show exceptions. *Sergey Nartimov*
+* Refactor ActionDispatch::ShowExceptions. Controller is responsible for choosing to show exceptions when `consider_all_requests_local` is false. *Sergey Nartimov*
- It's possible to override +show_detailed_exceptions?+ in controllers to specify which requests should provide debugging information on errors.
+ It's possible to override `show_detailed_exceptions?` in controllers to specify which requests should provide debugging information on errors.
* Responders now return 204 No Content for API requests without a response body (as in the new scaffold) *José Valim*
diff --git a/actionpack/lib/action_controller/metal/rescue.rb b/actionpack/lib/action_controller/metal/rescue.rb
index 736ff5b31c..c4b056ebc0 100644
--- a/actionpack/lib/action_controller/metal/rescue.rb
+++ b/actionpack/lib/action_controller/metal/rescue.rb
@@ -3,11 +3,6 @@ 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) &&
@@ -18,14 +13,14 @@ module ActionController #:nodoc:
end
def show_detailed_exceptions?
- consider_all_requests_local || request.local?
+ request.local?
end
private
def process_action(*args)
super
rescue Exception => exception
- request.env['action_dispatch.show_detailed_exceptions'] = show_detailed_exceptions?
+ 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 cb2e2b17aa..7af256fd99 100644
--- a/actionpack/lib/action_controller/railtie.rb
+++ b/actionpack/lib/action_controller/railtie.rb
@@ -21,8 +21,6 @@ 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
diff --git a/actionpack/test/controller/show_exceptions_test.rb b/actionpack/test/controller/show_exceptions_test.rb
index 5eff1eb09d..2f5c268330 100644
--- a/actionpack/test/controller/show_exceptions_test.rb
+++ b/actionpack/test/controller/show_exceptions_test.rb
@@ -5,9 +5,17 @@ module ShowExceptions
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
+ before_filter :only => :another_boom do
+ request.env["action_dispatch.show_detailed_exceptions"] = true
+ end
+
def boom
raise 'boom!'
end
+
+ def another_boom
+ raise 'boom!'
+ end
end
class ShowExceptionsTest < ActionDispatch::IntegrationTest
@@ -27,9 +35,8 @@ module ShowExceptions
end
end
- test 'show diagnostics from a remote ip when consider_all_requests_local is true' do
- ShowExceptionsController.any_instance.stubs(:consider_all_requests_local).returns(true)
- @app = ShowExceptionsController.action(:boom)
+ test 'show diagnostics from a remote ip when env is already set' do
+ @app = ShowExceptionsController.action(:another_boom)
self.remote_addr = '208.77.188.166'
get '/'
assert_match(/boom/, body)