Sha256: c3df6f96e2b25c4d53897caab38c51b1387307e2531a266771ef9a940eb78ab2
Contents?: true
Size: 892 Bytes
Versions: 19
Compression:
Stored size: 892 Bytes
Contents
# frozen_string_literal: true module Decidim module Meetings # The data store for a Questionnaire in the Decidim::Meetings component. class Questionnaire < Meetings::ApplicationRecord belongs_to :questionnaire_for, polymorphic: true has_many :questions, -> { order(:position) }, class_name: "Question", foreign_key: "decidim_questionnaire_id", dependent: :destroy has_many :answers, class_name: "Answer", foreign_key: "decidim_questionnaire_id", dependent: :destroy # Public: returns whether the questionnaire questions can be modified or not. def questions_editable? has_component = questionnaire_for.meeting.respond_to? :component (has_component && !questionnaire_for.meeting.component.published?) || answers.empty? end def all_questions_unpublished? questions.all?(&:unpublished?) end end end end
Version data entries
19 entries across 19 versions & 1 rubygems