module VotesHelper def voters_list(votes, html = false) voters = votes.select {|v| !v.liker_url.nil?}.map do |v| if html tag.strong(link_to v.liker_name, v.liker_url) else "#{v.liker_name} (#{v.liker_url})" end end anons = votes.select {|v| v.liker_url.nil?}.size if anons > 0 if voters.empty? && anons == 1 if html voters << tag.strong("A guest") else voters << "A guest" end else if html voters << tag.strong(pluralize(anons, "guest")) else voters << pluralize(anons, "guest") end end end to_sentence(voters) end end