public
def initialize
puts “Called initialize…”
super.initialize
end
This generates the following error:
You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occured while evaluating nil.initialize
Within the body of a method, a call to super acts just like a call to
that
original method, except that the search for a method starts in the
superclass of the object that was found to have the original method.
Explains why you are getting the nil.initialize error. ‘super’ is like
calling initialize, which returns nil.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.