Displaying 2 results from an estimated 2 matches for "restaurant_id".
2006 Mar 14
3
Help doing find - look for nonempty habtm
...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 to
make it happen? I''m using Rails 1.0, but have no problem going to
Edge if that''ll make...
2006 Aug 22
0
Re: Problem with find condition and habtm relationship.
...ation to make things clear.
>
> I''m making a restaurant directory in RoR. I have a table of
> Restaurants
> and a table of Features which both have a habtm relationship with each
> other using a jointable called features_restaurants which has the
> fields feature_id and restaurant_id.
>
> So restaurants can belong to many different features such as
> "vegitarian menu", "child friendly" etc. In the view checkboxes are
> dynamically created for each feature using the following code:
>
> <%= start_form_tag :action => ''by_feature...