diff options
author | Xavier Noria <fxn@hashref.com> | 2013-12-06 19:13:51 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-12-06 19:18:10 +0100 |
commit | 01c9782fa2392729bea08409e348fe049857d9d6 (patch) | |
tree | d4ef12c78ce6e98e77093e36573bf1c7728012e6 /tools | |
parent | 8ef1ef1b822cdb49e72edd16a8ddbc67e5e1cf94 (diff) | |
download | rails-01c9782fa2392729bea08409e348fe049857d9d6.tar.gz rails-01c9782fa2392729bea08409e348fe049857d9d6.tar.bz2 rails-01c9782fa2392729bea08409e348fe049857d9d6.zip |
better error message for constants autoloaded from anonymous modules [fixes #13204]
load_missing_constant is a private method that basically plays the role of const_missing.
This method has an error condition that is surprising: it raises if the class or module
already has the missing constant. How is it possible that if the class of module has
the constant Ruby has called const_missing in the first place?
The answer is that the from_mod argument is self except for anonymous modules, because
const_missing passes down Object in such case (see the comment in the source code of the
patch for the rationale).
But then, it is better to pass down Object *if Object is also missing the constant* and
otherwise err with an informative message right away.
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions