Babak Bst
Babak Bst

Reputation: 295

question about application.html.erb

i have a table in my application.html.erb.like this:

<body>
<table width='100%' border='3'>
  <tr><td height="100"> </td></tr>
  <tr>
    <td width="10%"></td>
    <td width="80%"></td>
    <td width="10%"></td>
  </tr>
</table>

<%= yield %>

</body>

i want to put contents of other page in <td width="80%"></td> but i dont know how can i do that? thank you for your helps

Upvotes: 0

Views: 186

Answers (2)

Simon Ernst
Simon Ernst

Reputation: 1430

<body>
<table width='100%' border='3'>
  <tr><td height="100"> </td></tr>
  <tr>
    <td width="10%"></td>
    <td width="80%"><%= render "other_page" %></td>
    <td width="10%"></td>
  </tr>
</table>

<%= yield %>

</body>

This will render _other_page.html.erb.

Read more about it here: http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials

Upvotes: 1

John Topley
John Topley

Reputation: 115362

Simply move the yield statement:

<body>
  <table width='100%' border='3'>
    <tr>
      <td height="100"></td>
    </tr>
    <tr>
      <td width="10%"></td>
      <td width="80%"><%= yield %></td>
      <td width="10%"></td>
    </tr>
  </table>
</body>

Upvotes: 1

Related Questions