Skip to content
Browse files

Fix AC::Metal#response_body= to store same value on Ruby 1.8 and 1.9

This was because String#respond_to?(:each) differs in 1.8 and 1.9
  • Loading branch information...
1 parent b454601 commit cc3e738d89cc5a433473559c3f70e98c08f646de @amatsuda amatsuda committed Nov 7, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 actionpack/lib/action_controller/metal.rb
View
8 actionpack/lib/action_controller/metal.rb
@@ -182,7 +182,13 @@ def status=(status)
end
def response_body=(val)
- body = val.nil? ? nil : (val.respond_to?(:each) ? val : [val])
+ body = if val.is_a?(String)
+ [val]
+ elsif val.nil? || val.respond_to?(:each)
+ val
+ else
+ [val]
+ end
super body
end

0 comments on commit cc3e738

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