500 error on "Edit Badges"

(Jakob Borg) #1

In v1.0.0, going to any user’s admin page and pressing “Edit Badges” results in this:

Started GET "/users/sockpuppet/badges_json.json?_=1409138601921" for at 2014-08-27 11:40:55 +0000
Processing by UserBadgesController#username as JSON
  Parameters: {"_"=>"1409138601921", "username"=>"sockpuppet"}
Completed 500 Internal Server Error in 19ms

NoMethodError (undefined method `position' for nil:NilClass):
  app/serializers/basic_user_badge_serializer.rb:11:in `grouping_position'
  app/controllers/application_controller.rb:187:in `serialize_data'
  app/controllers/application_controller.rb:198:in `render_serialized'
  app/controllers/user_badges_controller.rb:29:in `username'
  lib/middleware/anonymous_cache.rb:119:in `call'
  config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
  config/initializers/silence_logger.rb:26:in `call'
  lib/middleware/unicorn_oobgc.rb:95:in `process_client'

(Jakob Borg) #2

Right, so this was caused by having badges that were not in a group, because they were created before that was a thing. Fixed by fixing the badges. Perhaps this is something some db migration along the way could take care of?

(Sam Saffron) #3

Yeah, I fixed this in a migration afaik

(Sam Saffron) #4