# Using through with habtm

**URL:** <https://www.ruby-forum.com/t/using-through-with-habtm/107482>\
**Category:** Rails\
**Created:** [June 22, 2007, 4:51am UTC](https://www.ruby-forum.com/t/using-through-with-habtm/107482 "2007-06-22T04:51:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serengeti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Serengeti](https://www.ruby-forum.com/u/Serengeti)\
**Post date:** [June 22, 2007, 4:51am UTC](https://www.ruby-forum.com/t/using-through-with-habtm/107482/1 "2007-06-22T04:51:20Z")

</div>

I have two models with an habtm relationship:

Foo has\_and\_belongs\_to\_many Bars (and vice-versa, obviously).

Let’s say Bar has\_many Bazs (how the heck do you pluralize Baz?).

It would be nice to be able to say that Foo has\_many Bazs through =\>  
Bar, but this does not seem to work.

Am I right, or should it be possible to do this?

The best I have been able to do is this:

```
bazs = []
my_foo.bars.each do |b|
  bazs += b.bazs
end
bazs.uniq!

```

That’s not TOO messy, but not as clean as foo.bazs.

If I am right about foo.bazs not being possible, is there a better/  
cleaner workaround than the one I am using?
