mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04: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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user