module Invitation::User

Your user model must include this concern to send and receive invitations. Your user class must also be specified in the invitation configuration `Invitation.configure.user_model`.

Your user model code is responsible for managing associations to any organizations you wish to issue invitations to. Your user model will probably also include an authentication model.

For example, to make your user class `User` able to issue invitations to model `Account`:

class User < ActiveRecord::Base
  include Invitation::User
  include Authenticate::User

  has_many :account_memberships
  has_many :accounts, through: :account_memberships
end

Public Instance Methods

claim_invite(token) click to toggle source
# File lib/invitation/user.rb, line 26
def claim_invite(token)
  invite = Invite.find_by_token(token)
  return if invite.nil?
  invitable = invite.invitable
  invitable.add_invited_user self
  invite.recipient = self
  invite.save
end