aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/base.rb17
1 files changed, 15 insertions, 2 deletions
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 <tt>template_path</tt> (relative to the template_root).
# The hash in <tt>local_assigns</tt> 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 <tt>template_extension</tt>.