about summary refs log tree commit diff
path: root/app/models/linked_user.rb
blob: e049c6f774af20e8dc3864dfefbf59ff31370488 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# == Schema Information
#
# Table name: linked_users
#
#  id             :bigint(8)        not null, primary key
#  user_id        :bigint(8)
#  target_user_id :bigint(8)
#  created_at     :datetime         not null
#  updated_at     :datetime         not null
#

class LinkedUser < ApplicationRecord
  belongs_to :user, inverse_of: :linked_users
  belongs_to :target_user, class_name: 'User'

  validates :user_id, uniqueness: { scope: :target_user_id }
end