<%= yield :article %><%= yield :agentur %>

Hi i start my first project in ruby on rails and i dont know how to add to yields in one layout. i tried this but it dont works: folder strucur in view is: app/views/agenturs/index.html.erb app/views/articles/index.html.erb app/views/layouts/agenturs.html.erb app/views/layouts/articles.html.erb

file: app/views/layouts/articles.html.erb

<h1 class="accordion_toggle">Link1 open article<br /></h1> <div style="height: 0px; display: none;" class="accordion_content">   <div id="vertical_nested_container"> <%= yield :article %> </div> </div>

<h1 class="accordion_toggle">Link2 open agentur<br /></h1> <div style="height: 0px; display: none;" class="accordion_content">   <div id="vertical_nested_container"> <%= yield :agentur %> </div> </div>

Please help!!!

can nobody held me??? in one layout i iry to have two yields. first is: <%= yield :article %> and second is:<%= yield :agenturs %>

the first yield works great because the layout file is view/layouts/ articles.html.erb if i call the layout view/layouts/agenturs.html.erb then the second yield works fine.

in a browser the call looks like this: localhost:3000/articles or localhost:3000/agenturs

You need to have in your view:

<% content_for :article do %>   stuff goes here <% end %>

In order to know what replaces:

<%= yield :article %>

in your layout. One thing that's useful to know is that the view is rendered FIRST and then the layout is found and rendered. That's why the <%= yield %> and <%= yield :symbol %> can find the right parts to insert.

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com