private Method

Partials.render_partial(partial_path, object_assigns = nil, local_assigns = nil)

There's no documentation for this item.

Source Code

# File action_view/partials.rb, line 106
def render_partial(partial_path, object_assigns = nil, local_assigns = nil) #:nodoc:
  case partial_path
  when String, Symbol, NilClass
    path, partial_name = partial_pieces(partial_path)
    full_partial_path = File.join(path, "_#{partial_name}")
    object = extracting_object(partial_name, object_assigns)
    local_assigns = local_assigns ? local_assigns.clone : {}
    add_counter_to_local_assigns!(partial_name, local_assigns)
    add_object_to_local_assigns!(partial_name, local_assigns, object)

    if logger && logger.debug?
      ActionController::Base.benchmark("Rendered #{full_partial_path}", Logger::DEBUG, false) do
        render(full_partial_path, local_assigns)
      end
    else
        render(full_partial_path, local_assigns)
    end
  when ActionView::Helpers::FormBuilder
    builder_partial_path = partial_path.class.to_s.demodulize.underscore.sub(/_builder$/, '')
    render_partial(builder_partial_path, object_assigns, (local_assigns || {}).merge(builder_partial_path.to_sym => partial_path))
  when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Associations::HasManyThroughAssociation
    if partial_path.any?
      path       = ActionController::RecordIdentifier.partial_path(partial_path.first)
      collection = partial_path
      render_partial_collection(path, collection, nil, object_assigns.value)
    else
      ""
    end
  else
    render_partial(
      ActionController::RecordIdentifier.partial_path(partial_path),
      object_assigns, local_assigns)
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.