User Invitations

User registration is invite-based, powered by Devise Invitable.

How It Works

  1. An existing user (with invitation privileges) sends an invite via email
  2. The invitee receives an email with a registration link
  3. On accepting the invitation, the new user account is created

Auto-Populated Fields

The custom Users::InvitationsController overrides Devise’s invite_resource method to auto-populate the invitee’s record with:

  • target_language – copied from the inviter
  • fluent_language – copied from the inviter
  • community_id – copied from the inviter

This ensures new users are placed in the same community and language pair as the person who invited them.

Database Fields

Invitation tracking columns on the users table:

  • invitation_token – unique token for the invitation link
  • invitation_sent_at, invitation_accepted_at – timestamps
  • invitations_count – number of invitations sent by this user
  • invitation_limit – max invitations this user can send
  • invited_by_id, invited_by_type – polymorphic reference to the inviter

Routes

Managed via Devise with custom controller:

devise_for :users, controllers: { invitations: "users/invitations" }

This site uses Just the Docs, a documentation theme for Jekyll.