2019-12-06 20:18:35 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-09 20:38:40 +08:00
|
|
|
class RepositoryChecklistItem < ApplicationRecord
|
2019-12-06 20:18:35 +08:00
|
|
|
validates :data, presence: true,
|
|
|
|
uniqueness: { scope: :repository_column_id, case_sensitive: false },
|
|
|
|
length: { minimum: Constants::NAME_MIN_LENGTH,
|
|
|
|
maximum: Constants::NAME_MAX_LENGTH }
|
|
|
|
belongs_to :repository, inverse_of: :repository_checklist_items
|
|
|
|
belongs_to :repository_column
|
2019-12-06 21:16:20 +08:00
|
|
|
belongs_to :created_by, foreign_key: 'created_by_id', class_name: 'User',
|
2019-12-09 20:38:40 +08:00
|
|
|
inverse_of: :created_repository_checklist_types
|
2019-12-06 21:16:20 +08:00
|
|
|
belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User',
|
2019-12-09 20:38:40 +08:00
|
|
|
inverse_of: :modified_repository_checklist_types
|
2019-12-18 21:10:41 +08:00
|
|
|
has_many :repository_cell_values_checklist_items, dependent: :destroy
|
|
|
|
has_many :repository_checklist_values, through: :repository_cell_values_checklist_items
|
2019-12-06 20:18:35 +08:00
|
|
|
end
|