1 | # frozen_string_literal: true |
||
2 | |||
3 | # Model to represent visit schedules |
||
4 | View Code Duplication | class Schedule < ApplicationRecord |
|
0 ignored issues
–
show
Duplication
introduced
by
Loading history...
|
|||
5 | belongs_to :study |
||
6 | has_many :arms, inverse_of: :schedule |
||
7 | |||
8 | validates :name, presence: true |
||
9 | validates :study, presence: true |
||
10 | validates_uniqueness_of :name |
||
11 | validates_length_of :name, \ |
||
12 | within: 2..50, \ |
||
13 | too_long: 'pick a shorter name', \ |
||
14 | too_short: 'pick a longer name' |
||
15 | |||
16 | def to_s |
||
17 | name |
||
18 | end |
||
19 | end |
||
20 | |||
21 | # == Schema Information |
||
22 | # |
||
23 | # Table name: schedules |
||
24 | # |
||
25 | # id :integer not null, primary key |
||
26 | # name :string not null |
||
27 | # study_id :integer not null |
||
28 | # created_at :datetime not null |
||
29 | # updated_at :datetime not null |
||
30 | # |
||
31 | # Indexes |
||
32 | # |
||
33 | # index_schedules_on_name (name) |
||
34 | # index_schedules_on_study_id (study_id) |
||
35 | # |
||
36 |