RoR-Sql query

Well, I don’t know the answer, but you can probably use the sql query mentioned in this page: ( Do a browser search on string “Joining Three Tables”)

BTW, this email is to mention a different problem in your query: should not card be cards and book be books in your query (table names are, by convention, plural in rails) Try that too, might work.