# Find across has many association

**URL:** <https://discuss.rubyonrails.org/t/find-across-has-many-association/24400>\
**Category:** rubyonrails-talk\
**Created:** [February 5, 2008, 11:44pm UTC](https://discuss.rubyonrails.org/t/find-across-has-many-association/24400 "2008-02-05T23:44:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [February 5, 2008, 11:44pm UTC](https://discuss.rubyonrails.org/t/find-across-has-many-association/24400/1 "2008-02-05T23:44:45Z")

</div>

I have an article and category.

An article belongs to a category. A category has many articles.

I want to find all articles in the "programming" category.

I have tried: prog\_articles = Article.find(:all, :conditions =\> ["category = ?", "programming"])

I know this is wrong because the error message reports an unknown column on the article table (makes sense because this is a join).

What I do not understand is how to represent the join accurately?

I have scanned AWDR and not found an answer yet.

Thank you for any help.

John

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [February 5, 2008, 11:55pm UTC](https://discuss.rubyonrails.org/t/find-across-has-many-association/24400/2 "2008-02-05T23:55:50Z")

</div>

I added an :include =\> :category clause to the above statement and it seems to work now.

---

<div class="post-metadata">

**Author:** ![kevin\_cline](https://avatars.discourse-cdn.com/v4/letter/k/3d9bf3/32.png) [@kevin\_cline](https://discuss.rubyonrails.org/u/kevin_cline)\
**Post date:** [February 6, 2008, 3:41am UTC](https://discuss.rubyonrails.org/t/find-across-has-many-association/24400/3 "2008-02-06T03:41:21Z")

</div>

category.find\_by\_name("programming").articles
