From 81e814adfad6d4bba1af5f70a5a409f6d71f8f6c Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Fri, 20 Mar 2009 16:13:13 -0700 Subject: Working on being able to render :text with layouts --- actionpack/lib/action_controller/abstract/renderer.rb | 2 +- actionpack/lib/action_controller/new_base/renderer.rb | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb index ad996d0daf..d95158be42 100644 --- a/actionpack/lib/action_controller/abstract/renderer.rb +++ b/actionpack/lib/action_controller/abstract/renderer.rb @@ -31,7 +31,7 @@ module AbstractController # # :api: plugin def render_to_string(name = action_name, options = {}) - template = view_paths.find_by_parts(name.to_s, formats, options[:_prefix]) + template = options[:_template] || view_paths.find_by_parts(name.to_s, formats, options[:_prefix]) _render_template(template, options) end diff --git a/actionpack/lib/action_controller/new_base/renderer.rb b/actionpack/lib/action_controller/new_base/renderer.rb index 1308537160..6abf3cef11 100644 --- a/actionpack/lib/action_controller/new_base/renderer.rb +++ b/actionpack/lib/action_controller/new_base/renderer.rb @@ -35,15 +35,16 @@ module ActionController end if options.key?(:text) - _render_text(options) + options[:_template] = ActionView::TextTemplate.new(_text(options)) + template = nil elsif options.key?(:template) - template = options.delete(:template) - super(template) + template = options.delete(:template) elsif options.key?(:action) template = options.delete(:action).to_s options[:_prefix] = _prefix - super(template, options) end + + super(template, options) end private @@ -52,12 +53,12 @@ module ActionController controller_path end - def _render_text(options) + def _text(options) text = options.delete(:text) case text when nil then " " - else text.to_s + else text.to_s end end -- cgit v1.2.3