Groleo Marius schrieb: > > class B > def fun_b > p "B" > end > end > > class A > b = B.new > end > > a = A.new > a.b.fun_b > > The part that bugs me is this error: > ./test.rb:15: undefined method `b' for #<A:0xb7cafb24> (NoMethodError) > > What is the way to code the above ideea, so that the last line would be correct. Maybe this is what you want: class A attr_reader :b def initialize @b = B.new end end Note that here each instance of A has its own instance of B, which might not be what you want. Regards, Pit