user4928385
user4928385

Reputation:

Rails use default layout for controller

i'm new with Ruby on Rails and i can't figure out how to use a layout for a controller.

Actually, i have got in my views "layout" directory with application.html.erb inside.

In this file, i have got all my template, inside this there is a div class. Inside i would like to call my "pages" controller.

My route.rb is

root 'pages#show', page: 'home'
get 'pages/:page' => 'pages/#show'

What i have when i go on my website is of course the default layout. Now i would like to call every page (ex pages/home.html.erb) inside the div in layouts/application.html.erb

How should i do it?

Upvotes: 0

Views: 816

Answers (1)

Mike Belyakov
Mike Belyakov

Reputation: 1385

You need get into this guide Layouts and Rendering in Rails

And if I understand you right, you whant to do somethisng like

...
<div class='my_div'>
 <%= yeild %>
</div>
...

Upvotes: 0

Related Questions