Permalink
Browse files

Make AD::Response correctly handle bodies that respond_to?(:to_path) …

…as per the Rack spec
  • Loading branch information...
Carlhuda
Carlhuda committed Feb 24, 2010
1 parent 3345af6 commit a73f682e43016de520510e015802c48c9947a05c
Showing with 12 additions and 0 deletions.
  1. +12 −0 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 }

0 comments on commit a73f682

Please sign in to comment.