From 3162f386dcf39c8914cc5eb9858772f4ef10aab7 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 2 Jun 2005 20:12:34 +0000 Subject: Made Action View work with the new render :file/:partial style from the controller git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1379 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/base.rb | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index fa51ec2947..06df395cb2 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -193,8 +193,21 @@ module ActionView #:nodoc: # Renders the template present at template_path (relative to the template_root). # The hash in local_assigns is made available as local variables. - def render(template_path, local_assigns = {}) - render_file(template_path, true, local_assigns) + def render(options = {}, old_local_assigns = {}) + if options.is_a?(String) + render_file(options, true, old_local_assigns) + elsif options.is_a?(Hash) + options[:locals] ||= {} + options[:use_full_path] = options[:use_full_path].nil? ? true : options[:use_full_path] + + if options[:file] + render_file(options[:file], options[:use_full_path], options[:locals]) + elsif options[:partial] && options[:collection] + render_partial_collection(options[:partial], options[:collection], options[:spacer_template], options[:locals]) + elsif options.is_a?(Hash) && options[:partial] + render_partial(options[:partial], options[:object], options[:locals]) + end + end end # Renders the +template+ which is given as a string as either rhtml or rxml depending on template_extension. -- cgit v1.2.3