Method: Padrino::Rendering::ClassMethods#layout

Defined in:
padrino-helpers/lib/padrino/rendering.rb

#layout(name = :layout) { ... } ⇒ Object

Use layout like rails does or if a block given then like sinatra. If used without a block, sets the current layout for the route.

By default, searches in your:

app/views/layouts/application.(haml|erb|xxx) app/views/layout_name.(haml|erb|xxx)

If you define layout :custom then searches for your layouts in app/views/layouts/custom.(haml|erb|xxx) app/views/custom.(haml|erb|xxx)

Parameters:

  • name (Symbol) (defaults to: :layout)

    (:layout) The layout to use.

Yields:



97
98
99
100
# File 'padrino-helpers/lib/padrino/rendering.rb', line 97

def layout(name=:layout, &block)
  return super(name, &block) if block_given?
  @layout = name
end