blob: 91a52bf8f74d26b120c5f48a2d933f9f0c80788a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# frozen_string_literal: true
module AlertManagement
class AlertAssignee < ApplicationRecord
belongs_to :alert, inverse_of: :alert_assignees
belongs_to :assignee, class_name: 'User', foreign_key: :user_id
validates :alert, presence: true
validates :assignee, presence: true, uniqueness: { scope: :alert_id }
scope :for_alert_ids, -> (ids) { includes(:assignee).where(alert_id: ids) }
end
end
|