aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-02-23 16:29:29 -0800
committerCarlhuda <carlhuda@engineyard.com>2010-02-23 16:29:29 -0800
commita73f682e43016de520510e015802c48c9947a05c (patch)
treeff43152ec6b8824fc8bf5c3c52c9e38511c33dad
parent3345af61fb128d0a70793b235e3cb878781d6f40 (diff)
downloadrails-a73f682e43016de520510e015802c48c9947a05c.tar.gz
rails-a73f682e43016de520510e015802c48c9947a05c.tar.bz2
rails-a73f682e43016de520510e015802c48c9947a05c.zip
Make AD::Response correctly handle bodies that respond_to?(:to_path) as per the Rack spec
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index 1b8dd9abfd..e6ed28742f 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -82,6 +82,18 @@ module ActionDispatch # :nodoc:
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 }