From: "David A. Black" Date: 2008-07-28T02:29:20+09:00 Subject: Re: local constant Hi -- On Sun, 27 Jul 2008, Phlip wrote: > David A. Black wrote: > >> The magic loading shouldn't lead to those errors. It only does the >> magic loading for unresolved constant references, and once it loads >> the necessary file, any further references to the constant won't be >> unresolved. >> >> Maybe you've got some rogue "load" commands somewhere. > > See where I said 'partly due'? > > There are three kinds of loading: > > require 'foo' # must be on the $: path > > require 'path/to/foo' > > Foo.new # magic loading (via ActiveSupport?) There's also "load", which will (re)load unconditionally. That's why I was thinking you might have some of those around. > If the system requires the same file twice thru different paths, it will load > the same file twice. The (primitive) require only avoids reloading a file if > it sees the exact same path. So it does. Interesting. > The magic loader adds a third system to load - one where the path is > invisible. Hence it increases the odds of accidentally reloading a file. I guess I try to do one or the other: either an explicit require, or using the magic loader, but not both, so ideally the warning won't happen. Then again, it's only a warning, so not too dire if it does happen. > (This is not a request for newb advice, BTW!) I'm afraid I don't understand. David -- Rails training from David A. Black and Ruby Power and Light: * Advancing With Rails August 18-21 Edison, NJ * Co-taught by D.A. Black and Erik Kastner See http://www.rubypal.com for details and updates!