Hi everyone,
I'm wondering what is the correct way to access a column from a belongs_to table.
The code below works is OK for the product.category.name line but fails for the product.make.name line. Yet they are both the same - I must be doing something basically wrong ?
Models: In Product: belongs_to :category belongs_to :make
In Category & Make: has_many :products
TIA - Davo
<% for product in @products %> <tr> <td><%=h product.name %></td> <td><%=h product.category.name %></td> <td><%=h product.make.name %></td> <td><%= link_to 'Show', :action => 'show', :id => product %></td> <td><%= link_to 'Edit', :action => 'edit', :id => product %></td> <td><%= link_to 'Destroy', { :action => 'destroy', :id => product }, :confirm => 'Are you sure?', :method => :post %></td> </tr> <% end %>