diff options
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 |