Displaying 1 result from an estimated 1 matches for "cuisines_restaurants".
2006 Mar 14
3
Help doing find - look for nonempty habtm
I''ve got a Cuisine and a Restaurant model, with a habtm. One thing I
want to do is find all the cuisines that have at least one restaurant
associated with them. Right now I''m using the following SQL query:
SELECT DISTINCT(cuisines.*) FROM cuisines, restaurants,
cuisines_restaurants WHERE cuisines.id =
cuisines_restaurants.cuisine_id AND restaurants.id =
cuisines_restaurants.restaurant_id AND restaurants.approved_at IS NOT
NULL
That''s working fine. I''d really like to make this a pure AR thing
though so I can use the rest of the AR options. Any tips on how...