Q:

How to break a line much like  or \n in embedded ruby within a Haml file?

I am having trouble breaking a line in embedded ruby within a Haml file. I have the following code:
= "#{event.setup_time} Minute Setup" unless event.setup_time == nil
= "#{event.teardown_time} Minute Teardown" unless event.teardown_time == nil

But it is printing it all in one string. Any suggestions?
Cheers ~

A:

You can use a <br /> HTML tag like so:
= "#{event.setup_time} Minute Setup"       if event.setup_time.present?
%br/
= "#{event.teardown_time} Minute Teardown" if event.teardown_time.present?

If you want to avoid the <br /> if unnecessary, this might be your solution instead:
- if event.setup_time.present?
  = "#{event.setup_time} Minute Setup"       
  %br/
- if event.teardown_time.present?
  = "#{event.teardown_time} Minute Teardown" 

