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.
14 lines
543 B
Ruby
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
|