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

September 7th, 2008 at 6:14 am
[...] Calling initialize in ActiveRecord model causes nil.has_keys? error. [...]
September 30th, 2008 at 10:33 am
Why is ’super’ needed? Is this a bug in AR?
October 1st, 2008 at 10:27 am
Jason,
I am not certain as to why ‘initialize’ without super is require. I have not stepped through code yet. I would suspect that some Rails code in ActiveRecord already calls initialize and I am not implementing needed methods or variables in mine. This is in effect like a method override in Java I would think. So when I call empty to pick up parent class, I screw up inheritance.