From d58b57a3caf4ad434c2be4f63eecd9a1921c7c4a Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Wed, 29 Apr 2009 17:50:11 -0700 Subject: Move ContentType inline for now. Trying to avoid premature proliferation of modules. --- actionpack/lib/action_controller/new_base.rb | 1 - actionpack/lib/action_controller/new_base/content_type.rb | 15 --------------- actionpack/lib/action_controller/new_base/renderer.rb | 10 ++++++---- actionpack/test/new_base/test_helper.rb | 1 - 4 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 actionpack/lib/action_controller/new_base/content_type.rb diff --git a/actionpack/lib/action_controller/new_base.rb b/actionpack/lib/action_controller/new_base.rb index 9c8a6d0216..bfd8120e10 100644 --- a/actionpack/lib/action_controller/new_base.rb +++ b/actionpack/lib/action_controller/new_base.rb @@ -1,5 +1,4 @@ module ActionController - autoload :ContentType, "action_controller/new_base/content_type" autoload :HideActions, "action_controller/new_base/hide_actions" autoload :Http, "action_controller/new_base/base" autoload :Layouts, "action_controller/new_base/layouts" diff --git a/actionpack/lib/action_controller/new_base/content_type.rb b/actionpack/lib/action_controller/new_base/content_type.rb deleted file mode 100644 index d2206a31af..0000000000 --- a/actionpack/lib/action_controller/new_base/content_type.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ActionController - module ContentType - - def render_to_body(options = {}) - if content_type = options[:content_type] - response.content_type = content_type - end - - ret = super - response.content_type ||= options[:_template].mime_type - ret - end - - end -end \ No newline at end of file diff --git a/actionpack/lib/action_controller/new_base/renderer.rb b/actionpack/lib/action_controller/new_base/renderer.rb index 096a63e406..f21fd746b7 100644 --- a/actionpack/lib/action_controller/new_base/renderer.rb +++ b/actionpack/lib/action_controller/new_base/renderer.rb @@ -24,7 +24,9 @@ module ActionController options[:_prefix] = _prefix end - super(options) + ret = super(options) + response.content_type ||= options[:_template].mime_type + ret end private @@ -43,9 +45,9 @@ module ActionController end def _process_options(options) - if status = options[:status] - response.status = status.to_i - end + status, content_type = options.values_at(:status, :content_type) + response.status = status.to_i if status + response.content_type = content_type if content_type end end end diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb index d41c7283b7..03af5a66a6 100644 --- a/actionpack/test/new_base/test_helper.rb +++ b/actionpack/test/new_base/test_helper.rb @@ -42,7 +42,6 @@ module ActionController use ActionController::UrlFor use ActionController::Renderer use ActionController::Layouts - use ActionController::ContentType def self.inherited(klass) ::ActionController::Base2.subclasses << klass.to_s -- cgit v1.2.3