From: gopal pusuluri Date: 2006-04-12T20:11:58+09:00 Subject: Re: uninitialized constant Customer (NameError) Hi Mr.Pit Thanks for the solid information that u posted, yes the require "Customer" is the sentence which i missed out..... Thanks again for ur info,,, bye Pit Capitain wrote: > gopal pusuluri schrieb: >> Hi everybody, >> I created a class called Customer and created a sub class called >> Transaction. The problem iam facing is i can't extract the super class >> methods and variables from sub class (i.e from Transaction class). >> the error it shows is >> >> ruby Transaction.rb >> Transaction.rb:1: uninitialized constant Customer (NameError) >> >>>Exit code: 1 > > Since you get the error in line 1 of the Transaction.rb file, I guess it > starts with > > class Transaction < Customer > > and I guess you define the class Customer in a file Customer.rb. If I'm > correct, you first have to require the file with the Customer class, so > your file Transaction.rb has to start with > > require "Customer" > class Transaction < Customer > > Some further remarks: > > * You don't need to name the file after the class. And you don't have to > define each class in its own file. For example, you could define both of > your classes in a file called "app.rb". > > * I think Filenames with mixed uppercase and lowercase letters aren't > often used in Ruby land. > > * How can a transaction be a subclass of a customer? > > Regards, > Pit -- Posted via http://www.ruby-forum.com/.