On Jun 18, 8:27 pm, doug <[email protected]> wrote:
> I have seen a number of examples where HTML code is treated as a Ruby
> block. For example, here is one taken from the Agile Rails book:
>
> <% content_for( :sidebar) do %>
> <ul>
> <li>this text will be rendered</li>
> <li>and saved for later</li>
> <li>it may contain <%= "dynamic" %> stuff</li>
> </ul>
> <% end %>
>
> I have no idea how this works. Can someone please give me a clue as
> to how this works? Additionally (and this is what I am really trying
> to do) I'm wondering if there isn't some way I could use this approach
> to display a block of HTML code conditionally. Any ideas?
>
It captures the block and stashes it away for later. Don't you just
want
<% if something %>
html here
<% end %>
though ?
Fred
> Thanks for any input.
>
> ... doug
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---