# Single Table Inheritance Association Issue

**URL:** <https://www.ruby-forum.com/t/single-table-inheritance-association-issue/88556>\
**Category:** Ruby\
**Created:** [March 12, 2007, 5:02pm UTC](https://www.ruby-forum.com/t/single-table-inheritance-association-issue/88556 "2007-03-12T17:02:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 12, 2007, 5:02pm UTC](https://www.ruby-forum.com/t/single-table-inheritance-association-issue/88556/1 "2007-03-12T17:02:45Z")

</div>

Hi there,

I’m using STI in a new application, and something is terribly wrong with  
has\_many associations.

Right, so I have number of subclasses that inherit from one concrete  
base class. Each sub class can possibly have associations via has\_many,  
or has\_one. When I try to access a collection on the sub class(  
subclass.items), I get 'undefined method ‘items’ for '. The  
strange thing is, accessing these subclasses in script/console works  
fine, and even works the first time I run the app in some cases. Once I  
refresh the page I get this error though.

I’m totally at a loss here. Any help would be greatly appreciated!

Thanks in advance.

Mike.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 12, 2007, 5:21pm UTC](https://www.ruby-forum.com/t/single-table-inheritance-association-issue/88556/2 "2007-03-12T17:21:05Z")

</div>

On Mar 12, 10:02 am, Mike [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m using STI in a new application, and something is terribly wrong with  
> has\_many associations.  
> [snip]  
> I’m totally at a loss here. Any help would be greatly appreciated!

You have posted this question to the ruby-talk forum/newsgroup/mailing  
list, which is for general discussion of the Ruby language. You will  
probably get a better set of responses if you ask this question on the  
ruby-on-rails forum/group, which is for rails-specific questions, as  
yours is.

[http://groups.google.com/group/rubyonrails-talk](http://groups.google.com/group/rubyonrails-talk)
