I have an app that has Users, Libraries and Books.
Users have many Libraries. Libraries have many Users and Books. But Users and Books do not have a direct relationship. Users can only borrow Books from Libraries.
I'm stuck trying to get the collection of books that belongs to the libraries that a user is a member of. In other words, I want to get all of the books in a library that a given user belongs to.
To be clear, I don't want to go through the borrowing association that currently exists between users and books, because I want all the books in that library, not just the ones currently borrowed by the user.
I've tried to come up with this query for hours using SQL and Squeel, without luck... thanks in advance for your help.