I’m creating a system where users can refer other users and in turn receive benefits. I currently have a User model created via Devise for authentication.
Just wondering what is the best way to create the referral model?
So far I have something like this as my table:
id user_id referrer_id
However, by default referred_id will infer a model called referrer. Anyway to automate the creation of referrals? Also just wondering how others have implemented this feature.
If you only need to store the referring user there’s probably no need for another model. Just associate with another User object:
Just be sure to add a
referrer_idcolumn to youruserstable.