From a73f682e43016de520510e015802c48c9947a05c Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Tue, 23 Feb 2010 16:29:29 -0800 Subject: [PATCH] Make AD::Response correctly handle bodies that respond_to?(:to_path) as per the Rack spec --- actionpack/lib/action_dispatch/http/response.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 1b8dd9abfd23a..e6ed28742fa6d 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -82,6 +82,18 @@ def message end alias_method :status_message, :message + def respond_to?(method) + if method.to_sym == :to_path + @body.respond_to?(:to_path) + else + super + end + end + + def to_path + @body.to_path + end + def body str = '' each { |part| str << part.to_s }