The process of Referrals is simply:
Also if you are using referrals be sure to have a cron job or background job giving store credit where appropriate. A sample cron job can be found at lib/tasks/referrals.rake.
After a user signs up for the app there is a after_create event called on the user. "set_referral_registered_at"
If "set_referral_registered_at" finds a referral associated with the user's email address the referring user will see that the user registered. This does not trigger any bonus. Once this User makes a purchase, the "purchased_at" attribute is set and the referring user will get credit the next time the `lib/tasks/referrals.rake` job is run.