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!!! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On 23 Aug., 21:27, ramiz <ram...-Mmb7MZpHnFY@public.gmane.org> wrote:> 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!!!--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org On Aug 24, 2008, at 4:57 AM, ramiz wrote:> 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 > > On 23 Aug., 21:27, ramiz <ram...-Mmb7MZpHnFY@public.gmane.org> wrote: >> 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!!!--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---