GOT IT! You all had a piece of the puzzle.
(Robert: As an aside, you mean “you call Product.descendants()” – not
dependencies() – but that’s a trifle.)
I realized that my reason that the Fred/Robert solution didn’t work was
correct: a request passes in the string “PGEBusiness”, and the
controller code does something like:
file: metered_services_controller.rb
def create
…
class_name = params[“metered_service”] # e.g. “PGEBusiness”
@metered_service = Object.const_get(class_name).new( … )
…
end
Notice there’s nothing there that forces a load of MeteredService, so
the calls to require_dependency() at the bottom of metered_service.rb
aren’t invoked. But I can force a load of metered_service.rb by a call
to descendants():
def create
…
MeteredService.descendants()
class_name = params[“metered_service”] # e.g. “PGEBusiness”
@metered_service = Object.const_get(class_name).new( … )
…
end
And that works. phew Thanks for your patience.
- ff