Sorry, I don't really know how to title this question.
Here's my code in view:
<% country.cities.each_with_index do |city, i| %>
<% city.shops.each do |shop| %>
<%=h shop.name.join(", ") %>
<% end %>
<% end %>
So in this city, let's say there are three shops: Walmart, Ace Hardware, Harman Kardon.
The result of the above code would yield:
Walmart Ace Hardware Harman Kardon
How do I join each of them with ", "?
I tried <%= shop.name.join(", ") %>
but not permitted. Error.
Thanks. I love Stack Overflow community. You guys have been more, much more than awesome!
EDIT
I just noticed something. Walmart is in City A; Ace HArdware and Harman Kardon are in City B. That is why it joined city by city.