Search This Blog

Loading...

Friday, August 12, 2011

NoMethodError (undefined method `eq' for nil:NilClass):

Context: Rails 3 app
Problem: when trying to save! an instance of the join model in a has_many :through I was getting the following error:



NoMethodError (undefined method `eq' for nil:NilClass):
  app/models/user.rb:29:in `update_achievement'
  app/controllers/game_controller.rb:183:in `check_point'
  app/controllers/game_controller.rb:177:in `each'
  app/controllers/game_controller.rb:177:in `check_point'

The Solution: