On Tuesday, July 26, 2016 at 2:20:36 PM UTC-7, Andrew Burleson wrote:
>
> 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`
>

The many_through_many plugin does this.
 

>
> Or:
>
> Author -> many Books -> many Chapters -> many Versions -> many Comments
>
> ...and would like to query 'author.comments' or 'book.comments' ?
>

It handles this as well (it can handle an arbitrary number of join tables).

Thanks,
Jeremy

-- 
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