Sha256: d43eaf29815d83f704ce8dcf34f8bcf9e7ce0e0431c508f3da85789c07b02aeb

Contents?: true

Size: 474 Bytes

Versions: 2

Compression:

Stored size: 474 Bytes

Contents

# frozen_string_literals: true

module Jobshop
  class Role < ApplicationRecord
    self.primary_keys = %i[ organization_id role_id ]

    after_initialize { self.role_id ||= SecureRandom.uuid if new_record? }

    belongs_to :organization, inverse_of: :roles,
               primary_key: %i[ organization_id role_id ]

    has_many :role_assignments, inverse_of: :role,
             foreign_key: %i[ organization_id role_id ]

    validates :name, presence: true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jobshop-0.0.167 app/models/jobshop/role.rb
jobshop-0.0.163 app/models/jobshop/role.rb