2018-02-09 19:07:10 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2021-02-20 09:57:27 -08:00
|
|
|
# == Schema Information
|
|
|
|
|
#
|
|
|
|
|
# Table name: survey_submissions
|
|
|
|
|
#
|
|
|
|
|
# id :bigint not null, primary key
|
|
|
|
|
# created_at :datetime not null
|
|
|
|
|
# updated_at :datetime not null
|
|
|
|
|
# survey_id :integer
|
|
|
|
|
# user_id :integer
|
|
|
|
|
#
|
2016-06-28 18:16:06 +03:00
|
|
|
class SurveySubmission < ActiveRecord::Base
|
|
|
|
|
belongs_to :user
|
|
|
|
|
belongs_to :survey
|
|
|
|
|
has_many :survey_replies, through: :user
|
|
|
|
|
|
|
|
|
|
validates :user_id, uniqueness: { scope: :survey_id }
|
|
|
|
|
|
|
|
|
|
accepts_nested_attributes_for :survey_replies
|
|
|
|
|
end
|