Conditional logic in HAML

In the Haml tutorial has this sample:

ERB

Welcome to our site!

<%= print_information %>

<%= render :partial => "sidebar" %>

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

Google Analytics in prod
<% end %>

Haml

???

Any help would be much appreciated.

On Tue, Aug 18, 2009 at 2:58 AM, Noel Kelly[email protected]
wrote:

<%= render :partial => “sidebar” %>
= render :partial => “sidebar”
Google Analytics in prod

<% end %>

Haml

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

Andrew T.
http://ramblingsonrails.com

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs