Team invitations

The Teams component comes with a built-in invitations system, which gives your Rails application:

  • A way for users to invite other users as members to their account
  • A form for creating and sending an invitation
  • A flow for users to receive and accept their invitation
  • Invitation mailers and ability to re-send an invitation
  • Ability to give invited users a specific role in the account

Invitation form & mailer

Users can navigate to their account's settings > Team Members list > Invite a new member.

Here, the user sees a form where they can compose a custom message and send the invitation. This does the following:

  • Creates a new Invitation record
  • Sends the invitation mailer to the invited user

Invitation status

After an invitation has been created, it's listed in the invitations index view.

Users can see an invitation's status ("pending" or "accepted"), and they can re-send the invitation mailer, or edit the invitation mailer message before re-sending.

Users can also cancel the invitation, which will prevent the invited user from accepting the invitation (if they haven't already).

Invitation acceptance

When an invited user receives the invitation mailer, they can click the link in the mailer to accept the invitation.

This takes the user to the invitations/accept_invitation view, where they see the name of the account they've been invited to, and can proceed to create their password and register as a user. This does the following:

  • Creates the invited user's User record
  • Creates the invited user's AccountUser record, associated with the Account they've been invited to
    • It has a role set to whatever the role the invitation record dictates
  • Sets the Invitation record's status to "accepted"
Instrumental Components

I created Instrumental Components to make designing and building professional apps with Ruby on Rails easy, fast, and fun. I use it on all of my projects and I hope it helps you build something great.

Brian Casel
Brian Casel
Creator of Instrumental Components
Learn more Send me a question or request