mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 15:13:21 +08:00
14 lines
506 B
Ruby
14 lines
506 B
Ruby
class ProtocolKeyword < ApplicationRecord
|
|
auto_strip_attributes :name, nullify: false
|
|
validates :name,
|
|
length: { minimum: Constants::NAME_MIN_LENGTH,
|
|
maximum: Constants::NAME_MAX_LENGTH }
|
|
validates :team, presence: true
|
|
|
|
belongs_to :team, inverse_of: :protocol_keywords, optional: true
|
|
|
|
has_many :protocol_protocol_keywords,
|
|
inverse_of: :protocol_keyword,
|
|
dependent: :destroy
|
|
has_many :protocols, through: :protocol_protocol_keywords
|
|
end
|