diff options
author | Akira Matsuda <ronnie@dio.jp> | 2011-11-07 16:24:54 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2011-11-07 16:24:54 +0900 |
commit | cc3e738d89cc5a433473559c3f70e98c08f646de (patch) | |
tree | 0695c70fb46158b4cebe75a448cee2d9d72a5ff5 | |
parent | b454601be403bd58af4a93b459f98ff4e2d211ea (diff) | |
download | rails-cc3e738d89cc5a433473559c3f70e98c08f646de.tar.gz rails-cc3e738d89cc5a433473559c3f70e98c08f646de.tar.bz2 rails-cc3e738d89cc5a433473559c3f70e98c08f646de.zip |
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
-rw-r--r-- | actionpack/lib/action_controller/metal.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index 0133b2ecbc..125dbf6bb5 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -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 |