Module: Maquina::OrganizationScoped
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/maquina/organization_scoped.rb
Overview
A concern that adds organization association to models.
Usage
Include this concern in any model that needs to be scoped to an organization:
class MyModel < ApplicationRecord
include Maquina::OrganizationScoped
end
Associations
When included, automatically adds:
organization-
Belongs to an Organization through maquina_organization_id foreign key
Example
class Project < ApplicationRecord
include Maquina::OrganizationScoped
# Project now has organization association
end
project = Project.create(organization: current_organization)
project.organization # => returns associated Maquina::Organization