diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-08 14:44:45 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-08 16:14:41 -0700 |
commit | 7056e2aa18647319eb5a5e4cce34ed2d3d3553d7 (patch) | |
tree | 0ba84664119e5ba8350dab7022154fd6adbb334a | |
parent | b42c58636571ccbf4bfc23f89039f43e63c98211 (diff) | |
download | rails-7056e2aa18647319eb5a5e4cce34ed2d3d3553d7.tar.gz rails-7056e2aa18647319eb5a5e4cce34ed2d3d3553d7.tar.bz2 rails-7056e2aa18647319eb5a5e4cce34ed2d3d3553d7.zip |
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
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/rendering.rb | 2 |
2 files changed, 1 insertions, 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) |