Affiliate program

Hello all,

Does anyone know of a tutorial / gem / plugin that keeps track of /
manage affiliate programs?

I've got links, such as http://localhost:3000/referrals/ae46308a1

I need to know how I can manage this in my app.

Perhaps someone can offer a small run-through on this concept and how
this can be done and what tables are needed?

Am just getting started on this, so any information is appreciated