Skip to content

Commit

Permalink
Fix AC::Metal#response_body= to store same value on Ruby 1.8 and 1.9
Browse files Browse the repository at this point in the history
This was because String#respond_to?(:each) differs in 1.8 and 1.9
  • Loading branch information
amatsuda committed Nov 7, 2011
1 parent b454601 commit cc3e738
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion actionpack/lib/action_controller/metal.rb
Expand Up @@ -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

Expand Down

0 comments on commit cc3e738

Please sign in to comment.