Files
nairobi/app/models/legislation/question_option.rb
Javi Martín 5e8746f026 Remove question option uniqueness validation
Having translations makes this validation too complex and not worth the
effort, since now we can't just scope in a single column but we need to
scope in the translations locale and the question ID.
2018-10-22 16:36:18 +02:00

14 lines
543 B
Ruby

class Legislation::QuestionOption < ActiveRecord::Base
acts_as_paranoid column: :hidden_at
include ActsAsParanoidAliases
translates :value, touch: true
include Globalizable
belongs_to :question, class_name: 'Legislation::Question', foreign_key: 'legislation_question_id', inverse_of: :question_options
has_many :answers, class_name: 'Legislation::Answer', foreign_key: 'legislation_question_id', dependent: :destroy, inverse_of: :question
validates :question, presence: true
validates_translation :value, presence: true
end