Reputation:
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
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