I have project and city table, and many-to-many relation between.
I want in html to get list of cities names, divided with ", ".
I tried with this:
<%= @project.cities(&:name).join(", ") %>
But I get (I think) object like this:
#<City:0x103886748>
Where I made a mistake? :|
P.S. Explanation:
I have @project that have one or more cities. I want to loop through cities and print names like this: New York, Boston, Belgrade (without comma on the end).