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:
parent
b454601be4
commit
cc3e738d89
1 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue