I've got this bit of code which returns an array of IDs like [1, 2, 3]
:
<% @articles.each do |a| %>
<%= a.brand_ids %>
<% end %>
Article
and Brand
have a has_many, :through
relationship. How would I return a list of the names of each brand instead of IDs? a.brands.name
returns Brand
. Any thoughts?