meta_search icon indicating copy to clipboard operation
meta_search copied to clipboard

Join table must be a string in a has_and_belongs_to_many association

Open garytaylor opened this issue 13 years ago • 2 comments

If you have a join table for an association which is a symbol rather than a string, searching this association fails (sorry, I cant remember the exact error as I have fixed it now !) - the end result was active record trying to downcase a symbol in the count_aliases_from_table_joins method.

Changing the :join_table definition in my model to a string fixed it.

Cheers

Gary

garytaylor avatar Jun 24 '11 07:06 garytaylor

I think this was an error in usage that would break manually-joined associations as well, and not just MetaSearch. Did joining the table yourself work OK?

ernie avatar Jun 24 '11 14:06 ernie

Hi, The join has been working for ages in my app, it seems that it only broke MetaSearch. Changing the :join_table in the AR model fixed everything

I think it is valid to use a symbol for a join table, but haven't checked.

Thanks

Gary On 24 Jun 2011, at 15:33, ernie wrote:

I think this was an error in usage that would break manually-joined associations as well, and not just MetaSearch. Did joining the table yourself work OK?

Reply to this email directly or view it on GitHub: https://github.com/ernie/meta_search/issues/37#issuecomment-1432673

garytaylor avatar Jun 24 '11 15:06 garytaylor