code-dot-org/dashboard — pull request #160 by cpirich (2013-11-20 00:17:59+00:00)
Title: redeem prizes working

Adding a new claim_prize method as /prize_providers/[:id]/claim_prize?type=[student|teacher|teacher_bonus]
This is routed to an assign_to_user method on either Prize, TeacherPrize, or TeacherBonusPrize which creates the one-to-one relationship between the prize and the user with appropriate locking and a transaction to ensure that both tables are updated atomically.
The UX on the redeem_prizes page has been updated to allow clicking on an available prize provider, confirming your intent to claim a prize, and then landing back on that page with the prize code visible - OR an error message.