Making Parents object attributes available

Hello,
I have a class Person
class Persoon < ActiveRecord::Base
set_table_name “Persoon”
set_primary_key “p_persoon”
has_many :adres, :class_name => “Adres”
composed_of :name, :class_name => Name, :mapping => [ [:naam,:naam],
[:voornaam,:voornaam], [:voornaam2,:voornaam2],
[:persnickname,:persnickname], [:perssortname,:perssortname] ]

def somemethod(string)

end
end

and a child class Student (which is a person)
class Student < Person
set_table_name “Student”
set_primary_key “p_persoon”
has_many :contract, :foreign_key => ‘p_persoon’
end

How can i access my Persons attributes when i have a Student object ?
like this
@student=student.new
puts student.somemethod (=> undefined method)
puts student.name.naam (which is just empty)

If i make a method in Student
def somemethod(string)
super
end
i get a stack level to deep error

On 23 Jan 2008, at 10:57, David De vits wrote:

end
end
i get a stack level to deep error

ActiveRecord only support single table inheritance (ie not what you’re
doing here).

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs