Move JSON generation to JBuilder.
Fix bug in battle.
Move permission control to CanCan.