T
Tony Arcieri
[Note: parts of this message were removed to make it a legal post.]
I've gone spelunking through ActiveRecord's dependencies.rb until my eyes
bleed, and I'm still yet to understand what causes these errors and how can
they can be prevented.
As far as I can tell, ActiveSupport's const_missing callback is triggered.
ActiveSupport then attempts automatic code loading, only to discover that
the constant is, in fact, already defined.
I am specifically encountering this problem trying to use a
dependency-resolving code loader:
http://github.com/tarcieri/require_all/tree/master
I've encountered this problem using Merb's code loader as well (albeit
outside of Merb). Merb's code loader works in the same way so I'm wondering
if this issue comes up with Merb as well.
In the latest case, the code loads in through the code loader correctly,
however when it tried to access a particular constant in a method body, the
error is generated, even though the class has been loaded. This doesn't
even happen consistently either: it is happening on one of my coworker's
computers (and only his computer, even though his setup is virtually
identical to our CI server). Also, it occurs only when the full Rails
environment is loaded, not in unit tests. *sigh*
This has been a perpetual thorn in my side for over a year. I really have
to wonder?
1) What does this "error" really mean?
2) Why is it an error?
3) Why can't ActiveSupport handle it internally?
4) What am I expected to do in order to fix it?
I've gone spelunking through ActiveRecord's dependencies.rb until my eyes
bleed, and I'm still yet to understand what causes these errors and how can
they can be prevented.
As far as I can tell, ActiveSupport's const_missing callback is triggered.
ActiveSupport then attempts automatic code loading, only to discover that
the constant is, in fact, already defined.
I am specifically encountering this problem trying to use a
dependency-resolving code loader:
http://github.com/tarcieri/require_all/tree/master
I've encountered this problem using Merb's code loader as well (albeit
outside of Merb). Merb's code loader works in the same way so I'm wondering
if this issue comes up with Merb as well.
In the latest case, the code loads in through the code loader correctly,
however when it tried to access a particular constant in a method body, the
error is generated, even though the class has been loaded. This doesn't
even happen consistently either: it is happening on one of my coworker's
computers (and only his computer, even though his setup is virtually
identical to our CI server). Also, it occurs only when the full Rails
environment is loaded, not in unit tests. *sigh*
This has been a perpetual thorn in my side for over a year. I really have
to wonder?
1) What does this "error" really mean?
2) Why is it an error?
3) Why can't ActiveSupport handle it internally?
4) What am I expected to do in order to fix it?