diff options
author | José Valim <jose.valim@gmail.com> | 2010-02-24 19:17:24 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-02-24 22:17:25 +0100 |
commit | a39c7505bd69e9da0a122fbb8fe20612390c57ff (patch) | |
tree | 591219c470c736e99aafccd76f027bbb0efcf4ed /actionpack/lib | |
parent | 6a061187e26f0942c458a859c8e941ed092a48c1 (diff) | |
download | rails-a39c7505bd69e9da0a122fbb8fe20612390c57ff.tar.gz rails-a39c7505bd69e9da0a122fbb8fe20612390c57ff.tar.bz2 rails-a39c7505bd69e9da0a122fbb8fe20612390c57ff.zip |
Cleanup render callstack and make render(:json => {}, :status => 401) work again.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/rendering.rb | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index 6518a464e2..b90c054e98 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -12,21 +12,13 @@ module ActionController end def render(*args) - if response_body - raise ::AbstractController::DoubleRenderError - end - + raise ::AbstractController::DoubleRenderError if response_body args << {} unless args.last.is_a?(Hash) super(*args) self.content_type ||= args.last[:_template].mime_type.to_s response_body end - def render_to_body(options) - _process_options(options) - super - end - private def _render_partial(options) @@ -35,24 +27,10 @@ module ActionController super end - def _determine_template(options) - if options.key?(:text) && options[:text].respond_to?(:to_text) - options[:text] = options[:text].to_text - end - super - end - def format_for_text formats.first end - def _process_options(options) - status, content_type, location = options.values_at(:status, :content_type, :location) - self.status = status if status - self.content_type = content_type if content_type - self.headers["Location"] = url_for(location) if location - end - def _normalize_options(action=nil, options={}, &blk) case action when NilClass @@ -64,12 +42,25 @@ module ActionController options.merge! :partial => action end + if options.key?(:text) && options[:text].respond_to?(:to_text) + options[:text] = options[:text].to_text + end + if options[:status] options[:status] = Rack::Utils.status_code(options[:status]) end options[:update] = blk if block_given? + + _process_options(options) options end + + def _process_options(options) + status, content_type, location = options.values_at(:status, :content_type, :location) + self.status = status if status + self.content_type = content_type if content_type + self.headers["Location"] = url_for(location) if location + end end end |