diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-26 15:31:23 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-26 15:31:23 -0700 |
commit | 3b8395a8825962b7ddbcb43a24334e5a5994ffde (patch) | |
tree | 8fff2dcabc2699b8f912d0a8fef59ad057b4cae6 /actionpack/lib/action_controller | |
parent | 2ceb16e539d13bb0f130dddd630776ea13ee9597 (diff) | |
download | rails-3b8395a8825962b7ddbcb43a24334e5a5994ffde.tar.gz rails-3b8395a8825962b7ddbcb43a24334e5a5994ffde.tar.bz2 rails-3b8395a8825962b7ddbcb43a24334e5a5994ffde.zip |
only call self.content_type= when there is a response
Apparently the AbstractController (whatever "abstract" means) is
expected to work without a request and response.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/mime_responds.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/rendering.rb | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/metal/mime_responds.rb b/actionpack/lib/action_controller/metal/mime_responds.rb index 1db68db20f..e62da0fa70 100644 --- a/actionpack/lib/action_controller/metal/mime_responds.rb +++ b/actionpack/lib/action_controller/metal/mime_responds.rb @@ -191,6 +191,7 @@ module ActionController #:nodoc: if format = collector.negotiate_format(request) _process_format(format) + _set_content_type _get_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 a2d671486d..c8934b367f 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -56,10 +56,12 @@ module ActionController nil end - def _process_format(format) - super + def _get_content_type(rendered_format) + self.content_type || super + end - self.content_type ||= format.to_s + def _set_content_type(format) + self.content_type = format end # Normalize arguments by catching blocks and setting them on :update. |