Issues (14)

app/models/study_event_instrument.rb (1 issue)

1
# frozen_string_literal: true
2
3
# Association class between study events and instruments
4
class StudyEventInstrument < ApplicationRecord
5
  belongs_to :study_event, inverse_of: :study_event_instruments
6
  belongs_to :instrument, inverse_of: :study_event_instruments
7
8
  validates :study_event, presence: true
9
  validates :instrument, presence: true
10
11
  validates_uniqueness_of :instrument, scope: :study_event
12 View Code Duplication
  validates_uniqueness_of :study_event, scope: :instrument
0 ignored issues
show
This code seems to be duplicated in your project.
Loading history...
13
  
14
  def to_s
15
    "#{study_event} #{instrument}"
16
  end
17
end
18
19
# == Schema Information
20
#
21
# Table name: study_event_instruments
22
#
23
#  id             :integer          not null, primary key
24
#  study_event_id :integer          not null
25
#  instrument_id  :integer          not null
26
#  created_at     :datetime         not null
27
#  updated_at     :datetime         not null
28
#
29
# Indexes
30
#
31
#  index_by_study_event_instrument                  (study_event_id,instrument_id) UNIQUE
32
#  index_study_event_instruments_on_instrument_id   (instrument_id)
33
#  index_study_event_instruments_on_study_event_id  (study_event_id)
34
#
35