Browse files

refactor response_body= method

response_to?(:each) returns false for strings in ruby 1.9, so there is no need for these checks
  • Loading branch information...
1 parent 591fcba commit 6f3420c0375bb6308b60c2d8df676aabf463a7cb @nashby nashby committed Jan 14, 2012
Showing with 1 addition and 7 deletions.
  1. +1 −7 actionpack/lib/action_controller/metal.rb
View
8 actionpack/lib/action_controller/metal.rb
@@ -182,13 +182,7 @@ def status=(status)
end
def response_body=(val)
- body = if val.is_a?(String)
- [val]
- elsif val.nil? || val.respond_to?(:each)
- val
- else
- [val]
- end
+ body = (val.nil? || val.respond_to?(:each)) ? val : [val]
super body
end

0 comments on commit 6f3420c

Please sign in to comment.