Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made Action View work with the new render :file/:partial style from t…

…he controller

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1379 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 3162f386dcf39c8914cc5eb9858772f4ef10aab7 1 parent e4c047e
@dhh dhh authored
Showing with 15 additions and 2 deletions.
  1. +15 −2 actionpack/lib/action_view/base.rb
View
17 actionpack/lib/action_view/base.rb
@@ -193,8 +193,21 @@ def render_file(template_path, use_full_path = true, local_assigns = {})
# 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>.
Please sign in to comment.
Something went wrong with that request. Please try again.