On 12 April 2016 at 08:52, Naveed Alam <li...@ruby-forum.com> wrote: >> As a beginner I suggest you work right through a good tutorial in >> order to get the basics or Rails. The one I suggest is >> railstutorial.org (which is free to use online). >> >> Colin > > Thanks colin I already tried this but it give me the error: > > undefined method `company_name' for nil:NilClass
Please quote the previous message when posting, this is a mailing list not a forum (though you may be accessing it via a forum like interface). If the statement category.supplier.company_name gives the error undefined method `company_name' for nil:NilClass then that means that category.supplier is nil, or to put it another way, it means that category does not have an associated supplier. You probably need something like <td><%= category.supplier.company_name if category.supplier %></td> which will only attempt to determine the name if category.supplier is not nil Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLv86ZWqzLWK3E%3DfSE7WJ0_d4WwNjsfEtXCt6Ds87RCQ_w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.