Hi i have the following code:
class Color < ActiveRecord::Base has_many :products end
class Product < ActiveRecord::Base belongs_to :color end
Products index view:
<% @products.each do |product| %> <tr> <td><%=h product.color_id %></td> <td><%= link_to 'Show', product %></td> <td><%= link_to 'Edit', edit_product_path(product) %></td> <td><%= link_to 'Destroy', product, :confirm => 'Are you sure?', :method => :delete %></td> </tr> <% end %>
How do I get this: <td><%=h product.color_id %></td> to display the name of the color instead of the id?