Sha256: 7ae963f52715623a12ae5f7385229e9ff7f693d0cc41cbe325888e5216b91402

Contents?: true

Size: 911 Bytes

Versions: 4

Compression:

Stored size: 911 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Consultations
    class Response < ApplicationRecord
      belongs_to :question,
                 foreign_key: "decidim_consultations_questions_id",
                 class_name: "Decidim::Consultations::Question",
                 counter_cache: :responses_count,
                 inverse_of: :responses

      has_many :votes,
               foreign_key: "decidim_consultations_response_id",
               class_name: "Decidim::Consultations::Vote",
               inverse_of: :response,
               dependent: :restrict_with_error

      belongs_to :response_group,
                 foreign_key: "decidim_consultations_response_group_id",
                 class_name: "Decidim::Consultations::ResponseGroup",
                 inverse_of: :responses,
                 counter_cache: :responses_count,
                 optional: true
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-consultations-0.22.0 app/models/decidim/consultations/response.rb
decidim-consultations-0.21.0 app/models/decidim/consultations/response.rb
decidim-consultations-0.20.1 app/models/decidim/consultations/response.rb
decidim-consultations-0.20.0 app/models/decidim/consultations/response.rb