app/models/question.rb
def surveillance_programs
    SurveillanceProgram.joins(surveys: :survey_sections)
                       .joins('INNER join section_nested_items on section_nested_items.section_id = survey_sections.section_id')
                       .where('section_nested_items.question_id = ?', id).select(:id, :name).distinct.to_a
  end
# Get the programs that the section is associated with by the surveys that the
# section is contained in
Get the programs that the section is associated with by the surveys that the
section is contained in
Get the programs that the section is associated with by the surveys that the section is contained in
def surveillance_programs
    SurveillanceProgram.joins(surveys: :survey_sections)
                       .joins('INNER join section_nested_items on section_nested_items.section_id = survey_sections.section_id')
                       .where('section_nested_items.question_id = ?', id).select(:id, :name).distinct.to_a
  end
def surveillance_programs SurveillanceProgram . joins ( surveys : :survey_sections ) . joins ( 'INNER join section_nested_items on section_nested_items.section_id = survey_sections.section_id' ) . where ( 'section_nested_items.question_id = ?' , id ) . select ( :id , :name ) . distinct . to_a end
Get the programs that the section is associated with by the surveys that the
section is contained in
Get the programs that the section is associated with by the surveys that the section is contained in