I'm having an HAML issue writing an if else statement ...
I have this code :
- experiences.each_index do |index|
- if index % 2 == 0 ?
.group
.left
- else
.right
%p= experiences[index].company
And I would like to produce that kind of html:
<div class='group'>
<div class='left'></div>
<div class='right'></div>
</div>
Multiple times depending on my collection's lenght.
Any idea ? Thanks
EDIT> A workaround would be to do this :
- experiences.each_index do |index|
- if index % 2 == 0 ?
.group
.left
experiences[index]...
.right
experiences[index+1]...
But isn't there any better solution ?