content_for?(:thing) returns a boolean indicating whether there is content
stored for :thing. So you should use an if statement with it:


- if content_for?(:sidebar)
  .sidebar= yield(:sidebar)


chris

On Fri, Feb 25, 2011 at 1:42 PM, Slava Mikerin <mikerin.sl...@gmail.com>wrote:

> thank you for trying to help!
> I double checked everything and it still does not work. To summarize
> again I have
>
> in a layout:
> ..
> - content_for?(:sidebar) do
>  .sidebar= yield(:sidebar)
>
> and in a view
> ..
> - content_for :sidebar do
>  .signup
>     %h2 'placeholder'
>
> .signup and content do not get rendered to the page. changing -
> content_for? to = content_for? in the layout shows the word 'true' on
> the page, but not .sidebar
> Is this a bug in haml for rails?
>
>
> On Thu, Feb 24, 2011 at 10:22 PM, Phil Crissman <phil.criss...@gmail.com>
> wrote:
> >
> >
> >
> > On Fri, Feb 25, 2011 at 12:17 AM, Slava Mikerin <mikerin.sl...@gmail.com
> >
> > wrote:
> >>
> >> inside the layout
> >
> > According to everything you've said, everything is fine. You'll want to
> > double check.
> >
> >>
> >> On Thu, Feb 24, 2011 at 10:12 PM, Phil Crissman <
> phil.criss...@gmail.com>
> >> wrote:
> >> >
> >> > Phil
> >> >
> >> >
> >> > On Fri, Feb 25, 2011 at 12:07 AM, slavix <mikerin.sl...@gmail.com>
> >> > wrote:
> >> >>
> >> >> .signup and the rest does not get rendered on the page.. not sure
> why.
> >> >
> >> > Where do you have:
> >> > =yield :sidebar
> >> > ?
> >> >
> >> >>
> >> >> On Feb 24, 9:58 pm, Phil Crissman <phil.criss...@gmail.com> wrote:
> >> >> > Phil
> >> >> >
> >> >> > On Thu, Feb 24, 2011 at 11:14 PM, Slava Mikerin
> >> >> > <mikerin.sl...@gmail.com>wrote:
> >> >> >
> >> >> > > inside a view i have:
> >> >> > > ..
> >> >> > > - content_for :sidebar do
> >> >> > >  .signup
> >> >> > >    %h2= 'Placeholder'
> >> >> >
> >> >> > That looks fine. You don't really need the '=' after the h2 if
> you're
> >> >> > only
> >> >> > putting plain text there, but it will still work.
> >> >> >
> >> >> > What's not working?
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > > On Thu, Feb 24, 2011 at 8:27 PM, Phil Crissman
> >> >> > > <phil.criss...@gmail.com>
> >> >> > > wrote:
> >> >> >
> >> >> > > > On Thu, Feb 24, 2011 at 8:20 PM, slavix <
> mikerin.sl...@gmail.com>
> >> >> > > > wrote:
> >> >> >
> >> >> > > >> Hello,
> >> >> > > >> Can someone please tell what is wrong with this syntax. For
> some
> >> >> > > >> reason it does not work..
> >> >> >
> >> >> > > >> - content_for?(:sidebar) do
> >> >> > > >>  .sidebar= yield(:sidebar)
> >> >> >
> >> >> > > > Where is the rest of the code?
> >> >> > > > If that .sidebar is inside your content_for block, then nothing
> >> >> > > > is
> >> >> > > > going
> >> >> > > to
> >> >> > > > happen... it's never actually being yielded in the view.
> >> >> >
> >> >> > > >> --
> >> >> > > >> You received this message because you are subscribed to the
> >> >> > > >> Google
> >> >> > > Groups
> >> >> > > >> "Haml" group.
> >> >> > > >> To post to this group, send email to haml@googlegroups.com.
> >> >> > > >> To unsubscribe from this group, send email to
> >> >> > > >> haml+unsubscr...@googlegroups.com.
> >> >> > > >> 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 haml@googlegroups.com.
> >> >> > > > To unsubscribe from this group, send email to
> >> >> > > > haml+unsubscr...@googlegroups.com.
> >> >> > > > 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 haml@googlegroups.com.
> >> >> > > To unsubscribe from this group, send email to
> >> >> > > haml+unsubscr...@googlegroups.com.
> >> >> > > 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 haml@googlegroups.com.
> >> >> To unsubscribe from this group, send email to
> >> >> haml+unsubscr...@googlegroups.com.
> >> >> 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 haml@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > haml+unsubscr...@googlegroups.com.
> >> > 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 haml@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> haml+unsubscr...@googlegroups.com.
> >> 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 haml@googlegroups.com.
> > To unsubscribe from this group, send email to
> > haml+unsubscr...@googlegroups.com.
> > 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 haml@googlegroups.com.
> To unsubscribe from this group, send email to
> haml+unsubscr...@googlegroups.com.
> 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 haml@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to