So, if I have something like:

Author -> many Books -> many Chapters

It's simple enough to join chapters to authors via books.
Chapter.many_to_many :authors, join_table: :books, left_key: :id, 
left_primary_key: :book_id, right_key: :author_id


But what if I have something like:

Author -> many Books -> many Chapters -> many Versions

...and would like to query `author.versions`

Or:

Author -> many Books -> many Chapters -> many Versions -> many Comments

...and would like to query 'author.comments' or 'book.comments' ?


I can subquery like:

Comment.where(version: Version.where(chapter: Chapter.where(book: 
Book.where(author: author))))

lol.

I mean, this works, but is there a better way?

Thanks!
Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-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].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to