# Overiding concatenation of tables by alphabetical order

**URL:** <https://www.ruby-forum.com/t/overiding-concatenation-of-tables-by-alphabetical-order/90368>\
**Category:** Rails\
**Created:** [March 28, 2007, 6:33am UTC](https://www.ruby-forum.com/t/overiding-concatenation-of-tables-by-alphabetical-order/90368 "2007-03-28T06:33:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgeuoa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@georgeuoa](https://www.ruby-forum.com/u/georgeuoa)\
**Post date:** [March 28, 2007, 6:33am UTC](https://www.ruby-forum.com/t/overiding-concatenation-of-tables-by-alphabetical-order/90368/1 "2007-03-28T06:33:35Z")

</div>

Hi everyone!

When doing a has\_and\_belongs\_to\_many join, with two tables, rails  
expects a join table whose name is the concatenation of the two table  
names in an alphabetical order.

However i have a number of tables which do not follow this convection  
and wish to have rails read and recognize them.

for example i have a table called feature and another called cvterm. The  
join table is however named feature\_cvterm (rails would expect one  
called cvterm\_feature) So it happily responds by generating an error  
that the table can’t be found or rather the class,

i wish to have rails recognize the feature\_cvterm join table.

Which is the easiest way to do it?

Please forgive my ignorance

( again the tribulations of working with a legacy database.)

Thanks

---

<div class="post-metadata">

**Author:** ![georgeuoa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@georgeuoa](https://www.ruby-forum.com/u/georgeuoa)\
**Post date:** [March 28, 2007, 12:15pm UTC](https://www.ruby-forum.com/t/overiding-concatenation-of-tables-by-alphabetical-order/90368/2 "2007-03-28T12:15:01Z")

</div>

Tanzanite T. wrote:

> join table is however named feature\_cvterm (rails would expect one
> 
> Thanks

has\_and\_belongs\_to\_many :cvterm, :join\_table =\> “feature\_cvterm”

–  
Michael W.

---

<div class="post-metadata">

**Author:** ![georgeuoa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7ab992/32.png) [@georgeuoa](https://www.ruby-forum.com/u/georgeuoa)\
**Post date:** [March 28, 2007, 8:05pm UTC](https://www.ruby-forum.com/t/overiding-concatenation-of-tables-by-alphabetical-order/90368/3 "2007-03-28T20:05:16Z")

</div>

Michael W. wrote:

> Tanzanite T. wrote:
> 
> > join table is however named feature\_cvterm (rails would expect one
> > 
> > Thanks
> 
> has\_and\_belongs\_to\_many :cvterm, :join\_table =\> “feature\_cvterm”
> 
> –  
> Michael W.

Thanks Michael,–

i got it.
