data.foo should be a merged array <%= @data['foo'].join(', ') %> and we can uniq it <%= @data['foo'].uniq.join(', ') %>