aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-04-23 01:16:21 +0200
committerXavier Noria <fxn@hashref.com>2011-04-23 01:16:21 +0200
commit384dbfd1408721ded071a587b0dc9ee40203607e (patch)
tree770854b984691dea8187ca0a998a28e93a008093 /actionpack/lib/action_dispatch
parent900470cf3cd346ad1b17cf6902f3f98e6dae7709 (diff)
parentaf1b48926f49226c934995c322ee017239158cf3 (diff)
downloadrails-384dbfd1408721ded071a587b0dc9ee40203607e.tar.gz
rails-384dbfd1408721ded071a587b0dc9ee40203607e.tar.bz2
rails-384dbfd1408721ded071a587b0dc9ee40203607e.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb10
-rw-r--r--actionpack/lib/action_dispatch/middleware/show_exceptions.rb2
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/response.rb2
3 files changed, 11 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index 78ecf177be..1f4f3ac0da 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -118,7 +118,15 @@ module ActionDispatch # :nodoc:
def body=(body)
@blank = true if body == EMPTY
- @body = body.respond_to?(:each) ? body : [body]
+
+ # Explicitly check for strings. This is *wrong* theoretically
+ # but if we don't check this, the performance on string bodies
+ # is bad on Ruby 1.8 (because strings responds to each then).
+ @body = if body.respond_to?(:to_str) || !body.respond_to?(:each)
+ [body]
+ else
+ body
+ end
end
def body_parts
diff --git a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
index dbe3206808..b1adf3d2d1 100644
--- a/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -50,7 +50,7 @@ module ActionDispatch
# Only this middleware cares about RoutingError. So, let's just raise
# it here.
if headers['X-Cascade'] == 'pass'
- raise ActionController::RoutingError, "No route matches #{env['PATH_INFO'].inspect}"
+ raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}"
end
rescue Exception => exception
raise exception if env['action_dispatch.show_exceptions'] == false
diff --git a/actionpack/lib/action_dispatch/testing/assertions/response.rb b/actionpack/lib/action_dispatch/testing/assertions/response.rb
index 8a04cfa886..e209978fb7 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/response.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/response.rb
@@ -42,7 +42,7 @@ module ActionDispatch
elsif type.is_a?(Symbol) && @response.response_code == Rack::Utils::SYMBOL_TO_STATUS_CODE[type]
assert_block("") { true } # to count the assertion
else
- assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) { false }
+ assert(false, build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code))
end
end