Posted by Colin Law (Guest) on 2013-11-12 14:56
Please quote the previous message so that the thread can be followed.
This is a mailing list not a forum, though you may be accessing it via
a forum like interface

>Thanks.  Did not know this.  I see it in the form of a forum.


Unfortunately, a minisection can belong to many books, chapters, ect...
> so needs a join table and can't be flattened.

Posted by Colin Law (Guest) on 2013-11-12 14:56
That does not make sense, in your original post you implied
minisection belongs_to subsection, and so on up through the heirarchy.
 Therefore any particular minisection is associated with only one
subsection, section, chapter and so on.


So, original question...
Having several tables related by "has_many" and would like to find the
"distant children".
eg:
Tables:
Subjects
Books
Chapters
Sections
Subsections
Minisections

They are all related heirarchichally, so book for example is related to
subjects and chapters the following way. All are related the same way.
Book
 belongs_to :subject
 has_many :chapters

So if I have the subject id, how can I find all the Minisections
belonging to that subject without adding all related table id's in each 
table?

-- 
Posted via http://www.ruby-forum.com/.

-- 
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/90f8b1d69ff472137ce8164abc1b451b%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to