All Fixed !
The error was caused by Nil data in makes_id for one of the entries -
once I fixed that all came good !
cheers, Dave
On Aug 26, 4:45 pm, Davo
<Dave.SouthPe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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 %>
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---