Renders the template present at template_path (relative to the view_paths array). The hash in local_assigns is made available as local variables.
Source Code
# File action_view/base.rb, line 296 def render(options = {}, old_local_assigns = {}, &block) #:nodoc: if options.is_a?(String) render_file(options, true, old_local_assigns) elsif options == :update update_page(&block) elsif options.is_a?(Hash) options = options.reverse_merge(:locals => {}, :use_full_path => true) if options[:layout] path, partial_name = partial_pieces(options.delete(:layout)) if block_given? wrap_content_for_layout capture(&block) do concat(render(options.merge(:partial => "#{path}/#{partial_name}")), block.binding) end else wrap_content_for_layout render(options) do render(options.merge(:partial => "#{path}/#{partial_name}")) end end elsif 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[:partial] render_partial(options[:partial], ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals]) elsif options[:inline] template = Template.new(self, options[:inline], false, options[:locals], true, options[:type]) render_template(template) end end end
<code/>and<pre/>for code samples.