Sep 02

When instantiating a model class this error occurs:

instance = MyModel.new
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.has_key?

This is rectified by placing a super within model class.

def initialize
super
logger.debug("initialize VirtualMta: #{self.class}")
end

Tagged with: