The pull request with all the code.

I recommend refactoring your ratings controller and using that as a model for this one... there are a lot of the same issues.