Sha256: 91543f9edbccbcad49df74ef83d187fab4c903408932b82ce3bf7dc6c8562f18

Contents?: true

Size: 694 Bytes

Versions: 6

Compression:

Stored size: 694 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Forms
    class AnswerOption < Forms::ApplicationRecord
      include Decidim::TranslatableResource

      default_scope { order(arel_table[:id].asc) }

      translatable_fields :body

      belongs_to :question, class_name: "Question", foreign_key: "decidim_question_id", counter_cache: true

      has_many :display_conditions,
               class_name: "DisplayCondition",
               foreign_key: "decidim_answer_option_id",
               dependent: :nullify,
               inverse_of: :answer_option

      def translated_body
        Decidim::Forms::AnswerOptionPresenter.new(self).translated_body
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-forms-0.29.1 app/models/decidim/forms/answer_option.rb
decidim-forms-0.29.0 app/models/decidim/forms/answer_option.rb
decidim-forms-0.29.0.rc4 app/models/decidim/forms/answer_option.rb
decidim-forms-0.29.0.rc3 app/models/decidim/forms/answer_option.rb
decidim-forms-0.29.0.rc2 app/models/decidim/forms/answer_option.rb
decidim-forms-0.29.0.rc1 app/models/decidim/forms/answer_option.rb