# Making Parents object attributes available

**URL:** <https://www.ruby-forum.com/t/making-parents-object-attributes-available/126908>\
**Category:** Rails\
**Created:** [January 23, 2008, 11:57am UTC](https://www.ruby-forum.com/t/making-parents-object-attributes-available/126908 "2008-01-23T11:57:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90ced4/32.png) [@davox](https://www.ruby-forum.com/u/davox)\
**Post date:** [January 23, 2008, 11:57am UTC](https://www.ruby-forum.com/t/making-parents-object-attributes-available/126908/1 "2008-01-23T11:57:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![davox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90ced4/32.png) [@davox](https://www.ruby-forum.com/u/davox)\
**Post date:** [January 23, 2008, 12:41pm UTC](https://www.ruby-forum.com/t/making-parents-object-attributes-available/126908/2 "2008-01-23T12:41:14Z")

</div>

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
