# Newbie quesiton about inheritance single table

**URL:** <https://www.ruby-forum.com/t/newbie-quesiton-about-inheritance-single-table/82822>\
**Category:** Ruby\
**Created:** [January 21, 2007, 2:25pm UTC](https://www.ruby-forum.com/t/newbie-quesiton-about-inheritance-single-table/82822 "2007-01-21T14:25:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@tobias](https://www.ruby-forum.com/u/tobias)\
**Post date:** [January 21, 2007, 2:25pm UTC](https://www.ruby-forum.com/t/newbie-quesiton-about-inheritance-single-table/82822/1 "2007-01-21T14:25:57Z")

</div>

Hello ng,

person.rb:

* * *

class Person \< ActiveRecord::Base

def initialize(mytype)  
@type=mytype.to\_s  
end

def self.find\_employee  
find(:all, :conditions =\> “type=‘Employee’’”)  
end

end

class Employee \< Person  
def initialize  
super(‘Employee’)  
end

end

class Manager \< Person  
def initialize  
super(‘Manager’)  
end

end

* * *

Okay, if I run ruby script/console  
and create an instance of Employee with :  
e= Employee.new

following error displayed:

uninitialized Constant Employee

if I first create a Person with:

p= Person.new(‘Bla Bla’)

and then create an instance of Employee  
with e= Employee.new

why is it so???

Thanks for help

Tobias

---

<div class="post-metadata">

**Author:** ![tobias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@tobias](https://www.ruby-forum.com/u/tobias)\
**Post date:** [January 21, 2007, 2:27pm UTC](https://www.ruby-forum.com/t/newbie-quesiton-about-inheritance-single-table/82822/2 "2007-01-21T14:27:58Z")

</div>

Tobias schrieb:

> def self.find\_employee
> 
> Okay, if I run ruby script/console
> 
> and then create an instance of Employee  
> with e= Employee.new
> 
> why is it so???
> 
> Thanks for help
> 
> Tobias

Sorry wrong ng
