scinote-web/app/models/team_assignment.rb
andrej-scinote d5b1fc0737
Merge pull request #8651 from andrej-scinote/aj_SCI_12056
Migrate objects to the new team assignments  [SCI-12056]
2025-07-16 11:10:50 +02:00

13 lines
394 B
Ruby

# frozen_string_literal: true
class TeamAssignment < ApplicationRecord
belongs_to :assignable, polymorphic: true, touch: true
belongs_to :team
belongs_to :user_role
belongs_to :assigned_by, class_name: 'User', optional: true
has_many :users, through: :team
enum :assigned, { automatically: 0, manually: 1 }, suffix: true
validates :team, uniqueness: { scope: :assignable }
end