I’m getting a weird “transient” error I’m hoping someone can shed some
In short, the first time view a particular page all is well. The
second time around, I get a bunch of active record model objects with
no public_instance_methods, so all code relying on that fails. Server
restart is required to fix it.
I have a method in one of my models that goes through several
associated models, iterates over the associated model objects and
further iterates into associated models on those to return some
distantly related model objects.
It works great… but only once for every server load. If I refresh the
page, subsequent calls to the accessor methods for the associations
have no methods!! So I get undefined method for something that clearly
existed just one refresh ago!
To give some more details, I have a Volunteer which has
VolunteerApplications which each have an Opportunity which each have
I want to get the organizations for a given volunteer… So I do so via
has_many :opportunities, :through => :volunteer_applications
which has created the opportunities method for me. I call that and
iterate over each and call organization on each (which was created by:
belongs_to :organization )
But upon refresh the organization accessor doesn’t exist for
opportunity, nor does any other.
Any clues? Ideas of how to better debug this? I’ve confirmed via
debugger that the attributes are all set on the model object, but it
has none of the association methods added by has_many, belongs_to,
I’ve also confirmed that belongs_to, etc are in fact being run.
Thanks in advance!