Nuby Question: How best to read a child record?

I want to read through all the child records for a given parent. What
would be the correct way to do this? Advise would be most welcome.

Regards,

Paul

Paul Jonathan T. wrote:

I want to read through all the child records for a given parent. What
would be the correct way to do this? Advise would be most welcome.

Use the collection method created by the association you use to define
the relation to the child records. I assume you are using has_many. So
if in class Parent you have “has_many :children” then “parent.children”
returns a collection of the child objects. Give the docs a shot:


Josh S.
http://blog.hasmanythrough.com