On 14 July 2010 21:31, Philrup <[email protected]> wrote: > I know this must be easy but I can not see it. I have a table with > types of material and a second table of the materials. So; > > MaterialType > has_many :materials > > and > > Material > belongs_to :material_type > > I want to display the list of materials as types and include the types > that have no materials, to show;
This might be helpful - http://railscasts.com/episodes/196-nested-model-form-part-1 > > Type 1 > 2 materials defined > Material 1 > Material 2 > <link to add new Type 1 material> > Type 2 > 0 materials defined > <link to add new Type 2 material> > Type 3 > 4 materials defined > Material 3 > Material 4 > Material 5 > Material 6 > <link to add new Type 3 material> > Etc > > The problem is I can show the materials types that have materials > defined but I can not work out how to show all the types especially > the ones without materials, so I can include the link to add one! -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

