AC::Metal#response_body= stores different value in Ruby 1.8 and 1.9 #3581

merged 2 commits into from Nov 10, 2011


None yet

2 participants

Ruby on Rails member
AC::Metal#response_body = 'foo'

stores ['foo'] in Ruby 1.9 but stores 'foo' in 1.8, because String#respond_to?(:each) differs in 1.8 and 1.9.

Although this is just an internal API, app developers sometimes need to directly refer to this value in some cases like monkey patching and testing. So it's nicer if this value doesn't be affected by Ruby version.

@amatsuda amatsuda 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
Ruby on Rails member

Sweet, can we have a test?

@amatsuda amatsuda A test case to ensure that AC::Metal#response_body= always wraps the …
…given value in an Array in both Ruby 1.8 and 1.9 (refs #3581)
Ruby on Rails member

Sure. Added a test case that fails in 1.8 without the former patch.

@josevalim josevalim merged commit d2cfa98 into rails:master Nov 10, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment