diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-02 20:12:34 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-02 20:12:34 +0000 |
commit | 3162f386dcf39c8914cc5eb9858772f4ef10aab7 (patch) | |
tree | 3e17b12bce7259cd2fb83da7a41ee405c19ebc1b /actionpack/lib | |
parent | e4c047e4891c446024e35548e872704d132ad2f7 (diff) | |
download | rails-3162f386dcf39c8914cc5eb9858772f4ef10aab7.tar.gz rails-3162f386dcf39c8914cc5eb9858772f4ef10aab7.tar.bz2 rails-3162f386dcf39c8914cc5eb9858772f4ef10aab7.zip |
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
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 17 |
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>. |