Default layouts in Sinatra (except from a stackxchange post)

Automatic Wrapping

To make every view default to be wrapped in a layout, create a file in erb/layout.erb and your calls to erb :myview will automatically be wrapped in this layout.

Skipping the Layout

If you want a particular view rendering not to use the layout, use:

 

Using a Different Layout

If you want to use a layout other than the common layout, create another file (for example views/admin_layout.haml) and then pass this as an option:

 

Published by

Leave a Reply