mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-16 22:25:30 +08:00
12 lines
360 B
Ruby
12 lines
360 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UserAssignment < ApplicationRecord
|
|
belongs_to :assignable, polymorphic: true, touch: true
|
|
belongs_to :user_role
|
|
belongs_to :user
|
|
belongs_to :assigned_by, class_name: 'User', optional: true
|
|
|
|
enum assigned: { automatically: 0, manually: 1 }, _suffix: true
|
|
|
|
validates :user, uniqueness: { scope: :assignable }
|
|
end
|