# Dont know how to use :include

**URL:** <https://www.ruby-forum.com/t/dont-know-how-to-use-include/111579>\
**Category:** Rails\
**Created:** [August 8, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/dont-know-how-to-use-include/111579 "2007-08-08T19:30:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ajit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a3d4f5/32.png) [@Ajit](https://www.ruby-forum.com/u/Ajit)\
**Post date:** [August 8, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/dont-know-how-to-use-include/111579/1 "2007-08-08T19:30:36Z")

</div>

Hi

i have two tables treatmentcategories and treatmentitems. each  
category has many items.

i have specified

has\_many :treatmentitems in treatmentcategories.rb model and  
belongs\_to :treatmentcategories in treatmentitems.rb model

in one of my def i am trying to display category with each item. So i  
used

@cats = Treatmentcategories.find(:all, :include =\> :treatmentitems)

but i am getting following error:

uninitialized constant Treatmentcategories::Treatmentitem

output i am looking for is:

cat1  
item1  
item2

cat2  
item1

and so on

please advice

thanks in advance

Ajit

---

<div class="post-metadata">

**Author:** ![Ajit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a3d4f5/32.png) [@Ajit](https://www.ruby-forum.com/u/Ajit)\
**Post date:** [August 9, 2007, 4:21pm UTC](https://www.ruby-forum.com/t/dont-know-how-to-use-include/111579/2 "2007-08-09T16:21:11Z")

</div>

Ajit wrote:

> belongs\_to :treatmentcategories in treatmentitems.rb model

Should be belongs\_to :treatmentcategory

–  
We develop, watch us RoR, in numbers too big to ignore.
