Hello I want to create a query that goes something like this, “Get me the variety which has the following ingredients(1,2,3)”
Here are my models
class Ingredient < ActiveRecord::Base
has_and_belongs_to_many :varieties
class Variety < ActiveRecord::Base
has_and_belongs_to_many :ingredients
I have been breaking my head but I haven’t been able to get it right, can someone help me out please. Thanks in advance!
Corrected after Dylan’s comment. I broke up the where_clause into a multi-line string for readability sake.