modified apn_on_rails gem from branch https://github.com/natescherer/apn_on_rails.git with error checking added