Ruby / Roda - Web Framework / Plugins / :partials


Introduction

The :partials plugin adds a +partial+ method, which renders templates without the layout.

plugin :partials, views: 'path/2/views'

Template files are prefixed with an underscore:

partial('test')     # uses _test.erb

partial('dir/test') # uses dir/_test.erb

This is basically equivalent to:

render('_test')

render('dir/_test')

Note that this plugin automatically loads the :render plugin.


InstanceMethods

#.partial(template, opts=OPTS)

Renders the given template without a layout, but prefixes the template filename to use with an underscore.