scinote-web/app/models/repository_list_item.rb

16 lines
645 B
Ruby
Raw Normal View History

class RepositoryListItem < ApplicationRecord
2018-02-09 23:28:21 +08:00
has_many :repository_list_values, inverse_of: :repository_list_item
2018-02-09 21:11:56 +08:00
belongs_to :repository, inverse_of: :repository_list_items
2018-02-12 16:05:41 +08:00
belongs_to :repository_column, inverse_of: :repository_list_items
2018-02-09 21:11:56 +08:00
belongs_to :created_by,
foreign_key: :created_by_id,
class_name: 'User'
belongs_to :last_modified_by,
foreign_key: :last_modified_by_id,
class_name: 'User'
2018-02-09 23:28:21 +08:00
validates :data,
presence: true,
2018-02-12 16:09:56 +08:00
uniqueness: { scope: :repository_column, case_sensitive: false },
length: { maximum: Constants::TEXT_MAX_LENGTH }
end