From: Jack Christensen Date: 2010-09-01T09:09:50+09:00 Subject: Ruby constant lookup for classes in modules What's the difference between defining a class inside of a module and using the module as a prefix? module Foo class Bar end end module Foo class Works def f Bar.new end end end class Foo::Fails def f Bar.new end end Foo::Works.new.f Foo::Fails.new.f The last line fails: lookup.rb:16:in `f': uninitialized constant Foo::Fails::Bar (NameError) from lookup.rb:21 I would have thought that both ways of placing a class in a module would be equivalent. Thanks. Jack