Padrino::Helpers::RenderHelpers

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.
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部