summaryrefslogtreecommitdiff
path: root/app/models/chat_name.rb
blob: f321db75eeb894787a47898d1d6ace88595bb3f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
class ChatName < ActiveRecord::Base
  belongs_to :service
  belongs_to :user

  validates :user, presence: true
  validates :service, presence: true
  validates :team_id, presence: true
  validates :chat_id, presence: true

  validates :user_id, uniqueness: { scope: [:service_id] }
  validates :chat_id, uniqueness: { scope: [:service_id, :team_id] }
end