@ Fred, @Robert Pankowecki:

Frederick Cheung wrote in post #996972:
> Have you been mixing in calls to require with calls to
> require_dependency/letting rails load things automatically? That can
> make a giant mess of things where some classes are reloaded and others
> aren't, so for example PGEService could be a subclass of the previous
> request's MeteredService

Fred:

Your explanation makes sense.  I haven't *intentionally* been mixing
calls -- I swore that off back in college after mixing kahlua and
tequila.  What I *have* tried:

[1] adding "require_dependency PGEBusiness' at the end of its superclass
(MeteredService), as suggested by Fred and Robert.  It didn't fix the
problem, I THINK because I have a form that passes back "PGEBusiness"
several transactions after MeteredService was loaded, by which point the
subclasses has been flushed.

[2] overloading MeteredService.descendents method as described above:

class MeteredService
  def self.descendants
    require_dependency 'metered_services/pge_business'
    ...
    super
  end
end

... which resulted in the "TypeError (superclass mismatch for class
PGEBusiness)" error I've seen.

[3] Same as [2], but using 'require' instead of 'require_dependency'.
Um, I think that also got the TypeError message.  That was several
commits ago -- I can go back and verify that was the problem.

So I'm still open to suggestions...

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to