| Total Complexity | 1 |
| Total Lines | 16 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | # frozen_string_literal: true |
||
| 4 | class Study < ApplicationRecord |
||
| 5 | has_one :schedule, inverse_of: :study, dependent: :destroy |
||
| 6 | has_many :study_participants, inverse_of: :study, dependent: :destroy |
||
| 7 | has_many :participants, through: :study_participants |
||
| 8 | |||
| 9 | validates :name, 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 | |||
| 34 |