我有一个双has_many:通过这样的关系:
class Survey < ActiveRecord::Base
has_many :surveyquestions
has_many :questions, through: :surveyquestions
end
class Question < ActiveRecord::Base
has_many :surveyquestions
has_many :surveys, through: :surveyquestions
has_many :kpiquestions, dependent: :destroy
has_many :kpis, through: :kpiquestions
end
class Kpi < ActiveRecord::Base
has_many :kpiquestions
has_many :questions, through: :kpiquestions
end
现在我想查询具有特定survey_id
和特定kpi_id
的问题,但我不确定如何查询?