Baffling undefined method

I have a model

class Person < CimHrdb

belongs_to :local_province, :foreign_key =>
“person_local_province_id”, :class_name => “Province”

end

(where CimHrdb extends some classes (with abstract_class = true) that
eventually extend ActiveRecord::Base)

and I’m getting

A NoMethodError occurred in reports#crisis_management:

undefined method local_province' for #<Person:0x40eec754> [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb: 1799:inmethod_missing’

The confusing thing is that it happens every once in a while. It’s
not every time. I can’t figure out why. It seems to not set up the
local_province method at times. This is on a production mongrel
server, btw.

-Andrew R.

Just wanted to follow up on this. I found out that it’s because one
of my log/mongrel.pid files got erased, so when mongrel was
restarting, it couldn’t kill one of them. Then it kept running with
old classes loaded. So one of my three mongrels had old classes
loaded, explaining why it only happened sometimes.

-Andrew

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs