bf4/ppwm-matcher — pull request #3 by joonty (2013-06-12 15:05:51+00:00)
Title: Replace existing pair functionality using DB driven models

Hi, final PR for the day!

This commit reproduces the existing functionality of pairing two users by codes, but it's now database driven. Here are the features:

* Add a `User` model, where each user is identified by their email (which we get from GH)
* Add a `paired_code_id` column to the codes table, so two codes are linked together
* Provide the method `Code.create_pair`, which generates two linked codes. There is currently a convenience URL `/code/create` that does this once
* Replace the existing Struct lookup with database lookups
* Check if the submitted code is in the database, otherwise redirect back for the user to enter the code again
* If the code is known, check to see if the paired code has been entered by another user, and spit out their email address if it has been
* Namespaced models and tables as requested in #2

I haven't touched the view at all - it would probably be a good point to start extracting out into view template files.

Feedback/criticism is welcome. Thanks!