W3cubDocs

/Padrino

Module: Padrino::Helpers::RenderHelpers

Overview

Helpers related to rendering within templates (i.e partials).

Instance Method Summary

Instance Method Details

#partial(template, options = {}, &block) ⇒ String Also known as: render_partial

Note: If using this from Sinatra, pass explicit :engine option

Render a partials with collections support.

Examples:

partial 'photo/item', :object => @photo
partial 'photo/item', :collection => @photos
partial 'photo/item', :locals => { :foo => :bar }
partial 'photo/item', :engine => :erb

Parameters:

  • template (String) — Relative path to partial template.
  • options (Hash) (defaults to: {}) — Options hash for rendering options.

Options Hash (options):

  • :object (Object) — Object rendered in partial.
  • :collection (Array<Object>) — Partial is rendered for each object in this collection.
  • :locals (Hash) — default: {} — Local variables accessible in the partial.
  • :engine (Symbol) — Explicit rendering engine to use for this partial.

Returns:

  • (String) — The html generated from this partial.