From: "brinda M." Date: 2013-01-08T07:04:42+09:00 Subject: Re: Newbie question: Referencing a class inside another class Thanks for the reply. However I should have been clear about what I meant. Sorry! The class is defined as follows: class SampleError end class Sample end They are defined in file lib/pkg/sample.rb. How do I reference SampleError from app/models/caller.rb since SampleError is defined inside sample.rb? Thanks! Henry Maddocks wrote in post #1091358: > On 8/01/2013, at 8:08 AM, "brinda M." wrote: > >> I have an Error class defined inside another class in the lib directory >> (i.e: Class SampleError is defined inside class >> lib/third_party_api/Sample class). How do I reference SampleError from >> outside > > class Foo > class Bar > def baz > p "Foo Bar baz" > end > end > end > > > Bar.new.baz > NameError: uninitialized constant Bar > > Use the fully qualified name > > Foo::Bar.new.baz > "Foo Bar baz" > => nil > > Henry -- Posted via http://www.ruby-forum.com/.