Response   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 10
wmc 1
1
# frozen_string_literal: true
2
3
# == Schema Information
4
#
5
# Table name: responses
6
#
7
#  id            :integer          not null, primary key
8
#  assessment_id :integer          not null
9
#  choice_id     :integer
10
#  value         :string           default(""), not null
11
#  created_at    :datetime         not null
12
#  updated_at    :datetime         not null
13
#
14
# Indexes
15
#
16
#  index_responses_on_assessment_id  (assessment_id)
17
#  index_responses_on_choice_id      (choice_id)
18
#
19
20
# Model to represent a response to an item
21
class Response < ApplicationRecord
22
  belongs_to :assessment, inverse_of: :responses
23
  belongs_to :choice, optional: true
24
25
  validates :assessment, presence: true
26
  validates :value, presence: true
27
28
  def to_s 
29
    "#{assessment} #{value}"
30
  end
31
end
32