Find models with a specified set of associated models


I have a many-to-many relationship between ‘dishes’ and ‘ingredients’.
Now how can I most efficiently search for dishes that have all of a
specific set of ingredients. Say, if I have two ingredients, ‘bananas’
and ‘walnuts’, how can I find all dishes that contain bananas and
walnuts (and maybe others)?

Thanks for any hint!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs