diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-08 14:57:33 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-09-08 16:14:41 -0700 |
commit | cd8eb351fb514a0e7225cb548e5eec082a0b495e (patch) | |
tree | dc24658a392491f539a31b3ab54d1a2f9c4c3be1 /actionpack/lib/action_controller | |
parent | 7056e2aa18647319eb5a5e4cce34ed2d3d3553d7 (diff) | |
download | rails-cd8eb351fb514a0e7225cb548e5eec082a0b495e.tar.gz rails-cd8eb351fb514a0e7225cb548e5eec082a0b495e.tar.bz2 rails-cd8eb351fb514a0e7225cb548e5eec082a0b495e.zip |
push content_type assigment in to metal
everything above metal really doesn't care about setting the content
type, so lets rearrange these methods to be in metal.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/mime_responds.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/rendering.rb | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/metal/mime_responds.rb b/actionpack/lib/action_controller/metal/mime_responds.rb index e62da0fa70..88a4818c16 100644 --- a/actionpack/lib/action_controller/metal/mime_responds.rb +++ b/actionpack/lib/action_controller/metal/mime_responds.rb @@ -191,7 +191,7 @@ module ActionController #:nodoc: if format = collector.negotiate_format(request) _process_format(format) - _set_content_type _get_content_type format + _set_rendered_content_type format response = collector.response response ? response.call : render({}) else diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index 363d45c722..4214399b6f 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -56,12 +56,14 @@ module ActionController nil end - def _get_content_type(rendered_format) - self.content_type || rendered_format.to_s + def _set_html_content_type + self.content_type = Mime::HTML.to_s end - def _set_content_type(format) - self.content_type = format + def _set_rendered_content_type(format) + unless response.content_type + self.content_type = format.to_s + end end # Normalize arguments by catching blocks and setting them on :update. |