Merge branch 'legislation-module-stable' into 13-draft-version-page

This commit is contained in:
Amaia Castro
2017-01-03 09:28:26 +01:00
3 changed files with 52 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
class Legislation::Answer < ActiveRecord::Base
belongs_to :question, class_name: 'Legislation::Question', foreign_key: 'legislation_question_id', dependent: :destroy, inverse_of: :answers, counter_cache: true
belongs_to :question_option, class_name: 'Legislation::QuestionOption', foreign_key: 'legislation_question_option_id', dependent: :destroy, inverse_of: :answers, counter_cache: true
belongs_to :question, class_name: 'Legislation::Question', foreign_key: 'legislation_question_id', inverse_of: :answers, counter_cache: true
belongs_to :question_option, class_name: 'Legislation::QuestionOption', foreign_key: 'legislation_question_option_id', inverse_of: :answers, counter_cache: true
belongs_to :user, dependent: :destroy, inverse_of: :legislation_answers
validates :question, presence: true, uniqueness: { scope: :user_id}