# Find across has many association

**URL:** <https://www.ruby-forum.com/t/find-across-has-many-association/128225>\
**Category:** Rails\
**Created:** [February 6, 2008, 12:44am UTC](https://www.ruby-forum.com/t/find-across-has-many-association/128225 "2008-02-06T00:44:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jh100000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@jh100000](https://www.ruby-forum.com/u/jh100000)\
**Post date:** [February 6, 2008, 12:44am UTC](https://www.ruby-forum.com/t/find-across-has-many-association/128225/1 "2008-02-06T00: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:** ![jh100000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@jh100000](https://www.ruby-forum.com/u/jh100000)\
**Post date:** [February 6, 2008, 12:55am UTC](https://www.ruby-forum.com/t/find-across-has-many-association/128225/2 "2008-02-06T00:55:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jh100000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@jh100000](https://www.ruby-forum.com/u/jh100000)\
**Post date:** [February 6, 2008, 4:42am UTC](https://www.ruby-forum.com/t/find-across-has-many-association/128225/3 "2008-02-06T04:42:10Z")

</div>

On Feb 5, 5:44 pm, John H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> …  
> A category has many articles.
> 
> I want to find all articles in the “programming” category.

category.find\_by\_name(“programming”).articles
