On 5 November 2015 at 10:32, Deepak Sharma <[email protected]> wrote: > ... > Now I want to fetch > same for consultant table i.e fetching consultant data in patient index > file. > > Rough example : > > <tbody> > <% @departments.each do |d| %> > <% d.patients.each do |patient| %> > <tr> > <td><%= patient.patient_name %></td> > <td><%= d.name %></td> > <% @consultants.each do |c| %> > <td><%= c.name %></td> > <% end %> > </tr> > <% end %> > <% end %> > </tbody> > > Something like above which fetch name field from consultant table in > patient's index file according to their respective ID.
What is the relationship between consultants and patients, that is in terms of has_many, belongs_to etc? 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLua1rj%2BE8Evtwx-Fmc_X9hXukBj%3DoEs9ob1K_fTVczNdw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

