mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
This commit is contained in:
parent
e4c047e489
commit
3162f386dc
1 changed files with 15 additions and 2 deletions
|
@ -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>.
|
||||
|
|
Loading…
Reference in a new issue