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?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.