# Multilevel Class inheritance

**URL:** <https://www.ruby-forum.com/t/multilevel-class-inheritance/128477>\
**Category:** Rails\
**Created:** [February 8, 2008, 12:18am UTC](https://www.ruby-forum.com/t/multilevel-class-inheritance/128477 "2008-02-08T00:18:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joergbattermann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@joergbattermann](https://www.ruby-forum.com/u/joergbattermann)\
**Post date:** [February 8, 2008, 12:18am UTC](https://www.ruby-forum.com/t/multilevel-class-inheritance/128477/1 "2008-02-08T00:18:55Z")

</div>

Hello there,

I am having a problem inheriting an already inherited class.

errr… sounds more complicated than it is… look:

class Item \< ActiveRecord::Base

# has a name and description field

end

class Reference \< Item

# has a something field

end

class UrlReference \< Reference  
#has an url field  
end

… now If I do make a u = UrlReference.new in the console for  
example, the u instance does NOT have the url field… only the ones  
from Reference and Item…

How come? I guess that’s basic ruby… but how do I properly inherit  
from other classes which again inherit from other ones? Did I miss  
something here?

Cheers & thanks,  
-Joerg
