From: "Iuri G." Date: 2012-05-09T23:40:55+09:00 Subject: change namespace scope / nesting problem Hello everybody. I am having problem with nested modules and includes not changing namespaces. I am trying to be DRY by moving out some common methods into a module, but when I do that, my nesting changes and the class names are not resolved properly. For example if I have modules Foo and Foo2, and each of those modules have 2 classes Bar and Helper. I also have Module Mixin:A which has methods for class Bar for each module. If a method in Mixin::A tries to access Helper, I get error Mixin::A::Helper is undefined. It is resolving to Mixin::A namespace instead of Foo or Foo2. Here is the sample code that demonstrates my problem. Thanks. module Mixins; end module Mixins::A def self.included(base) base.class_eval do def test_it Helper end end end end module Foo class Helper end class Bar include Mixins::A end end module Foo2 class Helper end class Bar include Mixins::A end end Foo::Bar.new.test_it #=> should return Foo::Helper Foo2::Bar.new.test_it #=> Should return Foo2::Helper -- Posted via http://www.ruby-forum.com/.