Module: Organizations::Models::Concerns::HasOrganizations

Extended by:
ActiveSupport::Concern
Defined in:
lib/organizations/models/concerns/has_organizations.rb

Overview

Concern to add organization capabilities to a user model. Provides associations, role checks, permission checks, and actions.

Examples:

Basic usage

class User < ApplicationRecord
  has_organizations
end

With options

class User < ApplicationRecord
  has_organizations do
    max_organizations 5
    create_personal_org true
    require_organization false
  end
end

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: DslProvider

Constant Summary collapse

OrganizationLimitReached =
Historical aliases — the CANONICAL constants live at Organizations

top level since 0.5.0 (rescue Organizations::CannotLeaveAsLastOwner, not this four-modules-deep path). Same class objects, so existing rescues of the nested paths keep working.

Organizations::OrganizationLimitReached
CannotLeaveLastOrganization =
Organizations::CannotLeaveLastOrganization
CannotLeaveAsLastOwner =
Organizations::CannotLeaveAsLastOwner
CannotDeleteAsOrganizationOwner =
Organizations::CannotDeleteAsOrganizationOwner
NoCurrentOrganization =
Organizations::NoCurrentOrganization