Sha256: 0387a9287dcf21e161c72b1402a3a2a73854c059ddfc603884a2fdd3d5c477f5

Contents?: true

Size: 664 Bytes

Versions: 3

Compression:

Stored size: 664 Bytes

Contents

module Authz
  # An instance represents a single mapping between a user and a role.
  # For example <'John', 'Publisher'>
  class RoleGrant < self::ApplicationRecord
    # Associations
    # ==========================================================================
    belongs_to :role, class_name: 'Authz::Role',
                      foreign_key: 'authz_role_id',
                      inverse_of: :role_grants
    belongs_to :rolable, polymorphic: true

    # Validations
    # ===========================================================================
    validates :authz_role_id,
              uniqueness: { scope: [:rolable_type, :rolable_id] }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authz-0.0.5 app/models/authz/role_grant.rb
authz-0.0.4 app/models/authz/role_grant.rb
authz-0.0.3 app/models/authz/role_grant.rb