Quickstart Accounts Authentication Teams Billing Subscriptions DevExp Scaffolding Admin Blog Deployment Kamal

Teams

Business Class multi-tenancy is implemented by teams. Teams are collections of users sharing resources tied to the same team_id.

Roles

Teams come with two default roles, members and owners. The very first user that starts a new team becomes it’s owner and we’ll be able to manage its subscription. An owner is then able to invite other members to the team.

The connection between an User and a Team is done via a shared TeamRole model. Any shared model will come with a dedicated team_id. Team-authorization is done automatically using TeamScopedController:

class WorkspacesController < TeamScopedController
  def index
    render "workspace"
  end

Invitations

An invitation can be accepted via an email or directly in the application as one user can be part of many teams. The team design also allows everyone to easily switch teams once logged in and even bookmark any of the pages.

Resources

Team models always come with team_id and the belongs_to :team association. They should be accessed from controllers based on TeamScopedController.

You can easily generate new team-scoped resources using a built-in generator:

$ bin/rails g crud Model title:string user:references