[email protected] wrote:
Tks, I was doing a hello worl only ehehe, and runing “ruby script/
server” on the prompt.
Then it sounds like you still have the problem. I’ve noticed the exact
same condition – a singleton getting initialized twice – and have
found a solution that works for me. (Sorry this is 10 months late, but
maybe it will help someone.)
I’m using 1.8.6-p36 on Windows.
In my case, the issue seemed related to the fact that ‘require’ behaves
badly if you happen to include the same file multiple times using
different path specifications (e.g., relative vs. absolute vs.
yet-another-relative). In those cases, the code in the file being
‘required’ gets executed each time a ‘new’ path formulation is used,
even though the same physical file is being referenced.
I addressed this by being careful to always File.expand_path(…) on the
path before doing a ‘require’, e.g.,
I should that, in my case, there was a chance the multiple requires
were being done on different threads. But, offhand, I don’t think they
So, I guess the moral is: Singleton users, beware the require