Initialize won't work??

I've got a simple model

class ExtraType < ActiveRecord::Base
  has_many :match_balls
  attr_accessor :extra_total
  def initialize
    self.extra_total=0
  end
end

When I try
ex=ExtraType.new, I get
INTERNAL ERROR!!! You have a nil object when you didn't expect it!
The error occurred while evaluating nil.has_key?
/Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:2633:in `has_attribute?'

I don't think I'm doing anything daft here .. or am I (It's the end of
a long week after all)
Ruby 1.8.6 with Rails 2.2.2

I've got a simple model

class ExtraType < ActiveRecord::Base
has_many :match_balls
attr_accessor :extra_total
def initialize
self.extra_total=0
end
end

When I try
ex=ExtraType.new, I get
INTERNAL ERROR!!! You have a nil object when you didn't expect it!
The error occurred while evaluating nil.has_key?
/Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:2633:in `has_attribute?'

I don't think I'm doing anything daft here .. or am I (It's the end of
a long week after all)

I think you should call super in initialize otherwise it is not doing
the base class initialize. Also watch out as I think rails does not
always call new to instantiate an object so your initialize may not
get called. See
http://blog.dalethatcher.com/2008/03/rails-dont-override-initialize-on.html
for example.

Colin

Many thanks. Calling super fixed it.
Doh - should have realised that - as I said - end of a long week.