diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-12 16:21:34 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-12 16:21:34 -0700 |
commit | 216309c16519d94a9e0aebf758029a78696ab8d6 (patch) | |
tree | db271a9f9cb8ddf9aed72e125fe867d0e10d40e0 /actionpack/lib/action_controller/new_base/renderer.rb | |
parent | 72ca7c591c9eace150c0ebab1633d691a1ef12cf (diff) | |
download | rails-216309c16519d94a9e0aebf758029a78696ab8d6.tar.gz rails-216309c16519d94a9e0aebf758029a78696ab8d6.tar.bz2 rails-216309c16519d94a9e0aebf758029a78696ab8d6.zip |
Implemented redirects and partial rendering in new base.
Diffstat (limited to 'actionpack/lib/action_controller/new_base/renderer.rb')
-rw-r--r-- | actionpack/lib/action_controller/new_base/renderer.rb | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/new_base/renderer.rb b/actionpack/lib/action_controller/new_base/renderer.rb index 41e3dfbe23..8a9f230603 100644 --- a/actionpack/lib/action_controller/new_base/renderer.rb +++ b/actionpack/lib/action_controller/new_base/renderer.rb @@ -9,13 +9,9 @@ module ActionController super end - def render(options = {}) + def render_to_body(options) _process_options(options) - super(options) - end - - def render_to_body(options) if options.key?(:text) options[:_template] = ActionView::TextTemplate.new(_text(options)) template = nil @@ -25,12 +21,18 @@ module ActionController options[:_template] = template elsif options.key?(:template) options[:_template_name] = options[:template] + elsif options.key?(:file) + options[:_template_name] = options[:file] + elsif options.key?(:partial) + _render_partial(options[:partial], options) else options[:_template_name] = (options[:action] || action_name).to_s options[:_prefix] = _prefix end ret = super(options) + + options[:_template] ||= _action_view._partial response.content_type ||= options[:_template].mime_type ret end @@ -49,6 +51,21 @@ module ActionController else text.to_s end end + + def _render_partial(partial, options) + case partial + when true + options[:_prefix] = _prefix + when String + options[:_prefix] = _prefix unless partial.index('/') + options[:_template_name] = partial + else + options[:_partial_object] = true + return + end + + options[:_partial] = options[:object] || true + end def _process_options(options) status, content_type = options.values_at(:status, :content_type) |