# Need :through to work as has many rather than HABTM

**URL:** <https://www.ruby-forum.com/t/need-through-to-work-as-has-many-rather-than-habtm/55522>\
**Category:** Rails\
**Created:** [March 21, 2006, 8:18pm UTC](https://www.ruby-forum.com/t/need-through-to-work-as-has-many-rather-than-habtm/55522 "2006-03-21T20:18:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [March 21, 2006, 8:18pm UTC](https://www.ruby-forum.com/t/need-through-to-work-as-has-many-rather-than-habtm/55522/1 "2006-03-21T20:18:12Z")

</div>

I’ve a horrible feeling I’m missing something here, but I’d like to have  
something like :through to model a has\_many relationship rather than a  
HABTM relationship (and I don’t think it does).

The is the model I have (simplified):

Users have many Models (and Models belong to Users)  
Models have many Pieces (and Pieces belong to Models)

In (badly drawn) graphical form:  
\_\_\_\_\_\_\_\_\_ \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
/ /  
Users/--------------Models/----------------------Pieces  
\_\_\_\_\_\_\_\_\_\_ \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

In a perfect world you would be able to use something like :through to  
get user.pieces…  
…but I know we don’t live in one of those. So, is there a neat way of  
doing this?

Thanks in advance

Chris T

---

<div class="post-metadata">

**Author:** ![christ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8e8cbc/32.png) [@christ](https://www.ruby-forum.com/u/christ)\
**Post date:** [March 21, 2006, 8:36pm UTC](https://www.ruby-forum.com/t/need-through-to-work-as-has-many-rather-than-habtm/55522/2 "2006-03-21T20:36:40Z")

</div>

ChrisT wrote:

> I’ve a horrible feeling I’m missing something here, but I’d like to have  
> something like :through to model a has\_many relationship rather than a  
> HABTM relationship (and I don’t think it does).

Never mind. Solved this through defining an instance method in the users  
class. Guess I was too eager to uses Edge Rails new bells&whistles  
forgot about the basics.  
CT
