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/abstract_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/abstract_controller')
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index a52aa8e874..765db74b2b 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -24,7 +24,11 @@ module AbstractController options = _normalize_render(*args, &block) self.response_body = render_to_body(options) _process_format(rendered_format) if rendered_format - self.content_type = Mime::TEXT if options[:plain] + if options[:plain] + _set_content_type Mime::TEXT.to_s + else + _set_content_type _get_content_type(rendered_format) + end self.response_body end @@ -103,6 +107,13 @@ module AbstractController def _process_format(format) end + def _get_content_type(rendered_format) # :nodoc: + rendered_format.to_s + end + + def _set_content_type(type) # :nodoc: + end + # Normalize args and options. # :api: private def _normalize_render(*args, &block) |