I have a partial that has a couple of content_for blocks in it. This works fine if I render it from a view that will in itself get rendered view yield :layout. But, if I try and render it directly from the application layout none of the content_for stuff gets interpreted. Two questions 1) Is this right? 2) If so, how can I always include a partial inside of my views then? Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I have a similar problem. Upgrading to Rails 2.2.2 from 2.1.2 i''ve lost all view components that are inserted with content_for. The content_for call sits inside a view helper, which in turn is used inside the view (eg http://railscasts.com/episodes/30-pretty-page-title). If i move the content_for call to inside the view it works fine. Any ideas out there? On Nov 23, 6:20 pm, phil <p...-o0Q4Q1ys/oVBDgjK7y7TUQ@public.gmane.org> wrote:> I have a partial that has a couple of content_for blocks in it. This > works fine if I render it from a view that will in itself get rendered > view yield :layout. But, if I try and render it directly from the > application layout none of the content_for stuff gets interpreted. > > Two questions > 1) Is this right? > 2) If so, how can I always include a partial inside of my views then? > > Thanks!--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve discovered something else. If you have an rjs template that loads in a partial: page.replace_html "current_channel", :partial => "edit_form" and on that page you have: _edit_form.rhtml: <script type="text/javascript" charset="utf-8"> function popup() { alert("way hay"); } </script> That javascript code is not being rendered. At all (as far as I can tell) On Nov 24, 8:44 am, Christopher <chris.spr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a similar problem. Upgrading to Rails 2.2.2 from 2.1.2 i''ve > lost all view components that are inserted with content_for. > > The content_for call sits inside a view helper, which in turn is used > inside the view (eghttp://railscasts.com/episodes/30-pretty-page-title). > If i move the content_for call to inside the view it works fine. > > Any ideas out there? > > On Nov 23, 6:20 pm, phil <p...-o0Q4Q1ys/oVBDgjK7y7TUQ@public.gmane.org> wrote: > > > I have a partial that has a couple of content_for blocks in it. This > > works fine if I render it from a view that will in itself get rendered > > view yield :layout. But, if I try and render it directly from the > > application layout none of the content_for stuff gets interpreted. > > > Two questions > > 1) Is this right? > > 2) If so, how can I always include a partial inside of my views then? > > > Thanks!--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try: content_for(:cow) { ''moo'' } This: content_for(:cow, ''moo) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Have the same problem. Is it a bug in Rails 2.2? Did they change something with content_for or capture/concat methods? -Szymon On 23 Lis, 17:20, phil <p...-o0Q4Q1ys/oVBDgjK7y7TUQ@public.gmane.org> wrote:> I have a partial that has a couple ofcontent_forblocks in it. Thisworksfine if I render it from a view that will in itself get rendered > viewyield:layout. But, if I try and render it directly from the > application layout none of thecontent_forstuff gets interpreted. > > Two questions > 1) Is this right? > 2) If so, how can I always include a partialinsideof my views then? > > Thanks!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''ve the same problem with content_for and yield. The contect of the content_for is not inserted in the yeld tag of the layout. I''ve upgraded from rails 2.1.2 to 2.2.2. In the view <% content_for :footer do %> footer text here <% end %> In the Layout <%= yield :footer %> Anyone know what the problem is? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Has Anyone found a solution to this? My setup is like this layout (pseudo-code) <html> <head> <%= yield : head %> </head> <body> <%= render :partial => ''home/menu'' %> <%= yield %> </body> </html> In my partial I have: <% content_for :head do %> <script>someJavaSCript</script> <% end %> Some Html blah blah.. And it is not rendering the content into my header thats defined in the partial thats rendered in the layout. I''m using some of the YUI stuff and I''m bundling the javascript and the html in the same file so it stays together nice and neat. Regards, Stephen Blackstone On Mon, Jan 26, 2009 at 11:21 AM, Jo Da <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> > I''ve the same problem with content_for and yield. The contect of the > content_for is not inserted in the yeld tag of the layout. > > I''ve upgraded from rails 2.1.2 to 2.2.2. > > In the view > <% content_for :footer do %> > footer text here > <% end %> > > In the Layout > > <%= yield :footer %> > > Anyone know what the problem is? > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The problem you''ve run into is that yield blocks have to be filled before they are called - normally, with the yields in the layout, everything else from the request will render first. But since you''re calling content_for in the layout, things aren''t working. The quickest way to do what you''re trying would be to put the html part in a content_for block, and then call the partial from the header (with a yield :menu_body where the current partial is). That puts the blocks into the correct order. --Matt Jones On Feb 6, 11:00 am, Stephen <sblackst...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Has Anyone found a solution to this? My setup is like this > > layout (pseudo-code) > > <html> > <head> > <%= yield : head %> > </head> > <body> > <%= render :partial => ''home/menu'' %> > <%= yield %> > </body> > </html> > > In my partial I have: > > <% content_for :head do %> > <script>someJavaSCript</script> > <% end %> > Some Html blah blah.. > > And it is not rendering the content into my header thats defined in the > partial thats rendered in the layout. I''m using some of the YUI stuff and > I''m bundling the javascript and the html in the same file so it stays > together nice and neat. > > Regards, > Stephen Blackstone > > On Mon, Jan 26, 2009 at 11:21 AM, Jo Da <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote: > > > > > I''ve the same problem with content_for and yield. The contect of the > > content_for is not inserted in the yeld tag of the layout. > > > I''ve upgraded from rails 2.1.2 to 2.2.2. > > > In the view > > <% content_for :footer do %> > > footer text here > > <% end %> > > > In the Layout > > > <%= yield :footer %> > > > Anyone know what the problem is? > > -- > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---