Overiding concatenation of tables by alphabetical order

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

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.

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.