I noticed the following today

I've a module SecuritySystem::SecretsProxy.  
SecuritySystem::SecretsProxy::AnyConstant evaluates to AnyConstant (as  
long as AnyConstant is something Dependencies can load but is not  
loaded yet), even though AnyConstant isn't defined at that level. The  
second time you evaluate SecuritySystem::SecretsProxy::AnyConstant  
then you get a NameError as I expected to get in the first place.

When load_missing_constant is called (to find AnyConstant inside  
SecuritySystem::SecretsProxy) it does check whether any of its parents  
defined AnyConstant (precisely so that  
SecuritySystem::SecretsProxy::AnyConstant cannot find ::AnyConstant.  
However in the edge case I describe AnyConstant has not been loaded at  
all and so this check does nothing.

I think this is slightly unhelpful behaviour (I certainly spent some  
time scratching my head as a result of it, the fact that it didn't  
occur in development because of the the reloading that goes on made it  
even more interesting). I've done a little playing around to see if I  
could catch this and raise a more helpful NameError but can't (at  
least not after half an hour's fiddling) come up with something that  
correctly identifies this situation.

Am I flogging a dead horse or does anyone have a bright idea/ helpful  
insight into this?

Fred

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to