This project is archived and is in readonly mode.

#3190 ✓duplicate
sds

HABTM no longer works when using multiple databases

Reported by sds | September 11th, 2009 @ 11:03 AM

The check has_primary_key? in has_and_belongs_to_many_association.rb fails when using multiple databases because it uses ActiveRecord::Base's connection and not the correct connection for the association.

This change changes it to use the @owner connection.

This first broke on this commit
http://github.com/rails/rails/commit/9c1bac0b7fcb627640db6824dca3e6...
- which was removed by commit http://github.com/rails/rails/commit/594a281d663dd8a7801651f4aea7e5... - but was again added by this commit http://github.com/rails/rails/commit/2b82708b0efb3a3458e8177beab58f...

I enclose a patch to fix it.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages