Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Has_many inviters instead of belongs_to #228

Open
gyarra opened this issue Aug 15, 2012 · 4 comments
Open

Has_many inviters instead of belongs_to #228

gyarra opened this issue Aug 15, 2012 · 4 comments
Labels

Comments

@gyarra
Copy link

gyarra commented Aug 15, 2012

If Joe sends an invitation to Alice, and later in the day Fred also sends an invite to Alice, we lose the information that Joe sent the initial invite. There's only one invited_by field, and the value stored there is the last inviter.

This doesn't meet the requirements for my application because we give credit to members for inviting other members. When Alice accepts the invitation, the second inviter, Fred, receives credit. Joe should also receive credit.

The best way to fix this would be to create a separate table for invitations. invited_by would become a has_many :through relationship rather than a belongs_to relationship. Invitations would belong_to inviter and also belong_to resource. So Invitations would be a many-to-many mapping table.

This may be more complication than you want to get into for the gem, but I'm not sure of another good way to fix this problem. A lot of sites want to give users credit for invites, so this seems like something that would be useful.

Thanks for the gem!
Gabe

@scashin133
Copy link

Are there any plans for doing something like this?

@frankis
Copy link

frankis commented May 25, 2015

Remember how it worked when gmail started? Participation upon invitation only.
User A receives a code/link to sign up and may invite up to x other people who may also invite up to x other people.

Such a feature would be a real cool thing - just think about how startups can use it to go viral.

Anyone implemented that already and can share the code?

@scambra
Copy link
Owner

scambra commented May 25, 2015

@frankis You only have to disable registrations and set a limit on invitations

@RoxasShadow
Copy link

In the meanwhile this feature is not implemented, I built this gem that, on top of devise_invitable, implements multiple invitations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants