Factor ability code for Units and Lessons, so that it's easier to use in containing Rails apps.