# Habtm does not work with multiple tables

**URL:** <https://www.ruby-forum.com/t/habtm-does-not-work-with-multiple-tables/59288>\
**Category:** Rails\
**Created:** [May 3, 2006, 1:10pm UTC](https://www.ruby-forum.com/t/habtm-does-not-work-with-multiple-tables/59288 "2006-05-03T13:10:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoobSaibot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/d2c977/32.png) [@NoobSaibot](https://www.ruby-forum.com/u/NoobSaibot)\
**Post date:** [May 3, 2006, 1:10pm UTC](https://www.ruby-forum.com/t/habtm-does-not-work-with-multiple-tables/59288/1 "2006-05-03T13:10:44Z")

</div>

as i’ve read somewhere. this could be fixed easily. all the rails devs (  
or whoever is responsible for the query building and executing part)  
have to do is to use the full qualifier in the sql statements (e. g.  
DB\_Name.Tablename.Row).

to solve that problem in the meanwhile one should define the :join\_table  
in the habtm association with the full qualifier.

---

<div class="post-metadata">

**Author:** ![NoobSaibot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/d2c977/32.png) [@NoobSaibot](https://www.ruby-forum.com/u/NoobSaibot)\
**Post date:** [May 3, 2006, 1:11pm UTC](https://www.ruby-forum.com/t/habtm-does-not-work-with-multiple-tables/59288/2 "2006-05-03T13:11:48Z")

</div>

The subject was meant to be “habtm does not work with multiple  
databases” of course ;o)

---

<div class="post-metadata">

**Author:** ![NoobSaibot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/d2c977/32.png) [@NoobSaibot](https://www.ruby-forum.com/u/NoobSaibot)\
**Post date:** [May 3, 2006, 1:57pm UTC](https://www.ruby-forum.com/t/habtm-does-not-work-with-multiple-tables/59288/3 "2006-05-03T13:57:37Z")

</div>

One thing though. as it seems the join\_table doesn’t get one of the  
needed two id’s for some reason, by creation. however, it does work  
correct on edit action.

it might be related to the fact that the object – of which the id is  
missing – is although defined as belongs\_to …, :polymorphic =\> true.
