app/models/questionnaire.rb
def has_questions?
    self.sections.each do |section|
      section.self_and_descendants do |s|
        if s.questions.present?
          return true
        end
      end
    end
    false
  end
#check if a questionnaire has at least one question
check if a questionnaire has at least one question
check if a questionnaire has at least one question
def has_questions?
    self.sections.each do |section|
      section.self_and_descendants do |s|
        if s.questions.present?
          return true
        end
      end
    end
    false
  end
def has_questions? self . sections . each do | section | section . self_and_descendants do | s | if s . questions . present? return true end end end false end
check if a questionnaire has at least one question
check if a questionnaire has at least one question