From 7056e2aa18647319eb5a5e4cce34ed2d3d3553d7 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 8 Sep 2015 14:44:45 -0700 Subject: avoid useless string allocations _set_content_type only does something when there is a request object, otherwise the return value of _get_content_type is always ignored. This commit moves everything to the module that has access to the request object so we'll never to_s unless there is a reason --- actionpack/lib/abstract_controller/rendering.rb | 1 - actionpack/lib/action_controller/metal/rendering.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index 6db0941b52..de00ffb0f9 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -107,7 +107,6 @@ module AbstractController end def _get_content_type(rendered_format) # :nodoc: - rendered_format.to_s end def _set_content_type(type) # :nodoc: diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index c8934b367f..363d45c722 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -57,7 +57,7 @@ module ActionController end def _get_content_type(rendered_format) - self.content_type || super + self.content_type || rendered_format.to_s end def _set_content_type(format) -- cgit v1.2.3