diff options
author | Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local> | 2009-05-27 10:40:43 +0200 |
---|---|---|
committer | Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local> | 2009-05-27 10:40:43 +0200 |
commit | 6bbe965ccdcef2d7e713e65175722718d325b2bd (patch) | |
tree | 5c9fc1d58b3f9ef692a356c49638d78611a51948 /actionpack/lib/action_controller/new_base/render_options.rb | |
parent | 311d686d031bbc7074bddd8d56ea42780a204b35 (diff) | |
download | rails-6bbe965ccdcef2d7e713e65175722718d325b2bd.tar.gz rails-6bbe965ccdcef2d7e713e65175722718d325b2bd.tar.bz2 rails-6bbe965ccdcef2d7e713e65175722718d325b2bd.zip |
Reduce the cost of using ActionController::Http significantly by:
* Removing the dependency on AD::Request and AD::Response
* Moving the logic for the request and response object
into a new module that is included by default.
* Changing Renderer and Redirector to use self.headers,
self.content_type, and self.status, which have very basic
default implementations on AC::Http. When RackConvenience
is included (which it is by default on AC::Base), the full
Request/Response logic is used instead of the simple logic.
Diffstat (limited to 'actionpack/lib/action_controller/new_base/render_options.rb')
-rw-r--r-- | actionpack/lib/action_controller/new_base/render_options.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/new_base/render_options.rb b/actionpack/lib/action_controller/new_base/render_options.rb index 581a92cb7b..48575ec0bd 100644 --- a/actionpack/lib/action_controller/new_base/render_options.rb +++ b/actionpack/lib/action_controller/new_base/render_options.rb @@ -57,7 +57,7 @@ module ActionController def _render_json(json, options) json = ActiveSupport::JSON.encode(json) unless json.respond_to?(:to_str) json = "#{options[:callback]}(#{json})" unless options[:callback].blank? - response.content_type ||= Mime::JSON + self.content_type ||= Mime::JSON self.response_body = json end end @@ -67,7 +67,7 @@ module ActionController register_renderer :js def _render_js(js, options) - response.content_type ||= Mime::JS + self.content_type ||= Mime::JS self.response_body = js end end @@ -77,7 +77,7 @@ module ActionController register_renderer :xml def _render_xml(xml, options) - response.content_type ||= Mime::XML + self.content_type ||= Mime::XML self.response_body = xml.respond_to?(:to_xml) ? xml.to_xml : xml end end @@ -88,7 +88,7 @@ module ActionController def _render_update(proc, options) generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(_action_view, &proc) - response.content_type = Mime::JS + self.content_type = Mime::JS self.response_body = generator.to_s end end |