Newbie quesiton about inheritance single table

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

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