Forum: Ruby on Rails Error: Called id for nil, which would mistakenly be 4

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Zhao Y. (Guest)
on 2009-01-21 04:53
I define a class:

class BuildLogger

  def self.get_build_logger(file_name=nil)
    if @@build_logger == nil      ###this line will thrown an error"build_logger")
      @@build_logger.level = DEBUG
    return @@build_logger

I invoke BuildLogger.get_build_logger in a controller. An error "Called
id for nil, which would mistakenly be 4 -- if you really wanted the id
of nil, use object_id" is always thrown on the "if" line. I have no idea
about this error. does anyone know this problem?
This topic is locked and can not be replied to.