I tried it in a pure haml rails3 app and it works. it really does append. so i guess it is something wrong with our app then. and since it is a huge one i can't pinpoint as to what is blocking it besides the erb mix. im in deep **** now. in any case, thanks for the help and suggestion! I'll just try to look for a work around with this one
On Aug 24, 5:22 pm, Chris Eppstein <[email protected]> wrote: > content_for(:foo) just appends to an instance variable called > @content_for_foo. > > yield(:foo) is basically syntactic candy for �...@content_for_foo. > > There's not really anything different between haml and erb in this respect. > Can you reproduce the issue in a fresh rails app? > > chris > > > > On Tue, Aug 24, 2010 at 2:05 AM, Eumir <[email protected]> wrote: > > is it possible because we are mixing haml and erb?(i know it > > shouldn't) the one calling the yield is in erb. the one calling > > content_for is haml > > > On Aug 24, 5:03 pm, Chris Eppstein <[email protected]> wrote: > > > content_for appends when I do that in my application. I suggest > > > investigating if any other plugins are messing with content_for. > > > > Can you reproduce this problem in a freshly generated rails application? > > > > On Tue, Aug 24, 2010 at 1:51 AM, Eumir <[email protected]> wrote: > > > > as stated in: > > > >http://apidock.com/rails/v2.3.8/ActionView/Helpers/CaptureHelper/cont. > > .. > > > > > content_for should APPEND if it encounters multiple calls. So, > > > > > <% content_for :navigation do %> > > > > <li><%= link_to 'Home', :action => 'index' %></li> > > > > <% end %> > > > > > <%# Add some other content, or use a different template: %> > > > > > <% content_for :navigation do %> > > > > <li><%= link_to 'Login', :action => 'login' %></li> > > > > <% end %> > > > > > should render both links in order. I have a similar code where I have > > > > > <%= javascript_include_tag "jquery" %> > > > > > <%= yield :jquery %> > > > > > <%= javascript_include_tag "prototype", "effects", "dragdrop", > > > > "controls", "lowpro", "neo", "filter", "slider", "calendar", > > > > "application", 'alerts' %> > > > > > In one partial, I call > > > > > - content_for(:jquery) do > > > > = javascript_include_tag "mylinks.js" > > > > > and in another > > > > > - content_for(:jquery) do > > > > = javascript_include_tag "lightbox.js" > > > > > problem with this is when i view source, only the lightbox is called. > > > > So it either ignores the mylinks call or it replaces it. Also the > > > > yield is inside the head tag but it apparently shows up right after > > > > the body tag(including all the other js after the yield). Is this a > > > > haml bug or a rails bug or am i doing something totally wrong? > > > > > Here's my question in SO: > > > > >http://stackoverflow.com/questions/3554254/appending-to-content-for-i. > > .. > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups > > > > "Haml" group. > > > > To post to this group, send email to [email protected]. > > > > To unsubscribe from this group, send email to > > > > [email protected]<haml%[email protected]>< > > haml%[email protected]<haml%[email protected]> > > >. > > > > For more options, visit this group at > > > >http://groups.google.com/group/haml?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Haml" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected] <haml%[email protected]>. > > For more options, visit this group at > >http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
