Conditional logic in HAML

In the Haml tutorial has this sample:

ERB

<div id='content'>
  <div class='left column'>
    <h2>Welcome to our site!</h2>
    <p><%= print_information %></p>
  </div>
  <div class="right column">
    <%= render :partial => "sidebar" %>
  </div>
</div>

Haml

#content
  .left.column
    %h2 Welcome to our site!
    %p= print_information
  .right.column
    = render :partial => "sidebar"

I want to convert a similar block that includes a conditional, but can't
find/google how to do it. Is it possible?

ERB

<% if ENV["RACK_ENV"] == "production" %>
  <%= render :partial => "ga" %>
<% else
  <div class="dev dummy">
    Google Analytics in prod
  </div>
<% end %>

Haml

???

Any help would be much appreciated.

···

--
Posted via http://www.ruby-forum.com/.

-if ENV["RACK_ENV"] == "production"
  =render :partial => "ga"
-else
  .dev.dummy Google Analytics in prod

Andrew Timberlake
http://ramblingsonrails.com

http://MyMvelope.com - The SIMPLE way to manage your savings

···

On Tue, Aug 18, 2009 at 2:58 AM, Noel Kelly<gnoll110@yahoo.com.au> wrote:

In the Haml tutorial has this sample:

ERB

<div id='content'>
<div class='left column'>
<h2>Welcome to our site!</h2>
<p><%= print_information %></p>
</div>
<div class="right column">
<%= render :partial => "sidebar" %>
</div>
</div>

Haml

#content
.left.column
%h2 Welcome to our site!
%p= print_information
.right.column
= render :partial => "sidebar"

I want to convert a similar block that includes a conditional, but can't
find/google how to do it. Is it possible?

ERB

<% if ENV["RACK_ENV"] == "production" %>
<%= render :partial => "ga" %>
<% else
<div class="dev dummy">
Google Analytics in prod
</div>
<% end %>

Haml