Skip to content
This repository
Browse code

render_to_string shouldn't play with response_body

  • Loading branch information...
commit c27fde26166f71ec68a7fb501435b656f436a687 1 parent a72fded
Santiago Pastorino authored
9  actionpack/lib/action_controller/metal/rendering.rb
@@ -18,13 +18,14 @@ def render(*args) #:nodoc:
18 18
 
19 19
     # Overwrite render_to_string because body can now be set to a rack body.
20 20
     def render_to_string(*)
21  
-      if self.response_body = super
  21
+      result = super
  22
+      if result.respond_to?(:each)
22 23
         string = ""
23  
-        self.response_body.each { |r| string << r }
  24
+        result.each { |r| string << r }
24 25
         string
  26
+      else
  27
+        result
25 28
       end
26  
-    ensure
27  
-      self.response_body = nil
28 29
     end
29 30
 
30 31
     def render_to_body(*)

0 notes on commit c27fde2

Please sign in to comment.
Something went wrong with that request. Please try again.