mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 10:06:53 +08:00
12 lines
485 B
Ruby
12 lines
485 B
Ruby
class ProtocolKeyword < ActiveRecord::Base
|
|
auto_strip_attributes :name, nullify: false
|
|
validates :name,
|
|
length: { minimum: Constants::NAME_MIN_LENGTH,
|
|
maximum: Constants::NAME_MAX_LENGTH }
|
|
validates :organization, presence: true
|
|
|
|
belongs_to :organization, inverse_of: :protocol_keywords
|
|
|
|
has_many :protocol_protocol_keywords, inverse_of: :protocol_keyword, dependent: :destroy
|
|
has_many :protocols, through: :protocol_protocol_keywords
|
|
end
|