1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
Akira Matsuda 2011-11-07 16:24:54 +09:00
parent b454601be4
commit cc3e738d89

View file

@ -182,7 +182,13 @@ module ActionController
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