# Has\_and\_belongs\_to\_many -- how to create test fixtures?

**URL:** <https://www.ruby-forum.com/t/has-and-belongs-to-many-how-to-create-test-fixtures/78912>\
**Category:** Rails\
**Created:** [March 9, 2006, 10:39am UTC](https://www.ruby-forum.com/t/has-and-belongs-to-many-how-to-create-test-fixtures/78912 "2006-03-09T10:39:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![doug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dbc845/32.png) [@doug](https://www.ruby-forum.com/u/doug)\
**Post date:** [March 9, 2006, 10:39am UTC](https://www.ruby-forum.com/t/has-and-belongs-to-many-how-to-create-test-fixtures/78912/1 "2006-03-09T10:39:58Z")

</div>

Hallo – can anyone offer me any pointers as to I should handle  
many-to-many relationships in Rails tests?  
Cheers,  
doug.

---

<div class="post-metadata">

**Author:** ![doug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dbc845/32.png) [@doug](https://www.ruby-forum.com/u/doug)\
**Post date:** [March 9, 2006, 12:59pm UTC](https://www.ruby-forum.com/t/has-and-belongs-to-many-how-to-create-test-fixtures/78912/2 "2006-03-09T12:59:57Z")

</div>

Just name the fixture file after the join table, eg people\_notes.yml if  
you are using has\_and\_belongs\_to\_many between the people and notes  
table.

-Jonny

doug wrote:

> Hallo – can anyone offer me any pointers as to I should handle  
> many-to-many relationships in Rails tests?  
> Cheers,  
> doug.

---

<div class="post-metadata">

**Author:** ![doug](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/dbc845/32.png) [@doug](https://www.ruby-forum.com/u/doug)\
**Post date:** [March 9, 2006, 1:01pm UTC](https://www.ruby-forum.com/t/has-and-belongs-to-many-how-to-create-test-fixtures/78912/3 "2006-03-09T13:01:51Z")

</div>

Jonathan V. wrote:

> Just name the fixture file after the join table, eg people\_notes.yml if  
> you are using has\_and\_belongs\_to\_many between the people and notes  
> table.
> 
> -Jonny
> 
> doug wrote:
> 
> > Hallo – can anyone offer me any pointers as to I should handle  
> > many-to-many relationships in Rails tests?  
> > Cheers,  
> > doug.

Thanks very much, man!
