What are Rails layouts?

Answer

Layouts are wrapper templates that surround view content, providing a consistent structure (header, footer, navigation) across pages. The default layout is app/views/layouts/application.html.erb, and all views are rendered inside it by default. The yield keyword inserts the view's content into the layout. Controllers can specify different layouts: layout 'admin' in the controller class, or per action. You can also use content_for/yield pairs for injecting view-specific content (like page titles or per-page JavaScript) into the layout.