Consider the following scenario:
Book has_and_belong_to_many Category.
In other words, a category may have a lot of books, and a book can
have more than one category.
What is the best practice to query all books related to some specified
For example, if I have following books
“From Java To Ruby” - Category: Java, Ruby
“Ruby P.ming” - Category: Ruby
“Inside Python” - Category: Python
If I search Java & Python, I got “From Java To Ruby” and “Inside
My goal is use a single query join to fetch the results.
It’s possible to use find_by_sql, but I wonder if is there any better