Learning Ruby on Rails I thought this would be a good idea:

%p
- @financial_benefits.each do |fb|
= link_to fb.name.capitalize
- unless fb == @financial_benefits.last
,

Apparently that inserts a space after a link. Not cool. In order to mitigate these issues, HAML has a series of helpers (e.g. succeed, precede) to abut text next to tags without whitespace. Now to get it right, I have to write this:

%p
- @health_benefits.each do |hb|
- unless hb == @health_benefits.last
= succeed "," do
= link_to hb.name.capitalize
- else
= link_to hb.name.capitalize

I don’t like that. I don’t like repeating code, especially in a language that I’m still learning to do correctly. Chris said it best, HAML sucks when you have to start using it inline.

EDIT: And since I am learning Ruby On Rails, thanks to an awesome commenter, I can get this down to one awesome line of code!

%p= @financial_benefits.map { |fb| link_to(fb.name.capitalize) }.join(', ').html_safe

I love that the join already takes care handling the last element, and how the html_safe portion handles the correct display of the items. Thanks Jeremy!