mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-06 15:40:31 +08:00
16 lines
564 B
Ruby
16 lines
564 B
Ruby
# frozen_string_literal: true
|
|
|
|
class RepositoryRowConnection < ApplicationRecord
|
|
belongs_to :parent,
|
|
class_name: 'RepositoryRow',
|
|
inverse_of: :child_connections,
|
|
counter_cache: :child_connections_count
|
|
belongs_to :child,
|
|
class_name: 'RepositoryRow',
|
|
inverse_of: :parent_connections,
|
|
counter_cache: :parent_connections_count
|
|
belongs_to :created_by, class_name: 'User'
|
|
belongs_to :last_modified_by, class_name: 'User'
|
|
|
|
validates :parent_id, uniqueness: { scope: :child_id }
|
|
end
|