course has_many tags by has_and_belongs_to, now given two id of tags, [1, 2], how to find all courses that have those both two tags
Course.joins(:tags).where("tags.id IN (?)" [1, 2])
will return record that have one of tags, not what I wanted
# app/models/course.rb
has_and_belongs_to_many :tags
# app/models/tag.rb
has_and_belongs_to_many :courses