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

For example, if I have following books
"From Java To Ruby" - Category: Java, Ruby
"Ruby Programming" - Category: Ruby
"Inside Python" - Category: Python

If I search Java & Python, I got "From Java To Ruby" and "Inside
Python".

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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to