I am trying to build an invitation system for my app and I feel like there’s a nice way to do what I need, yet I’m not sure about it.
I have a
User model and I created a
When an existing user sends out a new invite, a
UserInvite is created. I am storing when the invite was sent, generate an invite token to make signing up easier and send an email to the invited user.
When the invite is accepted, I would also like to store the user id of the new user on the
That is, a
UserInvite belongs to both inviter and the invitee, and the latter is only being added to the object later on, not at creation, since I don’t know the id of the to-be-created
What is the right way to model this relationship?
I’m using Rails 7.