scinote-web/app/models/team_repository.rb
2019-08-09 14:15:50 +02:00

12 lines
403 B
Ruby

# frozen_string_literal: true
class TeamRepository < ApplicationRecord
enum permission_level: Extends::SHARED_INVENTORIES_PERMISSION_LEVELS
belongs_to :team
belongs_to :repository
validates :permission_level, presence: true
validates :repository, uniqueness: { scope: :team_id }
validates :team_id, inclusion: { in: proc { |object| Team.pluck(:id) - [object.repository&.team&.id] } }
end