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
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs