Oh, also meant to say I don't know that the habtm thing is a bug (not a feature either : b). It's not the way I would like to see it work but the rails code that I looked at just flat doesn't make allowances for m2m relationship tables outside of the rails db that I could tell.
Gerald On Apr 14, 6:47 am, Matt Jones <[email protected]> wrote: > On Apr 13, 1:20 pm, Gerald Anderson <[email protected]> wrote: > > > > > > > > > > > Grr, have had two meetings in the middle of all this, forgive my lack > > of coherence. Bottom line is it looks like it instantiates the engine > > as the rails database and with no way (that I know of) of specifying > > which db to look at for the relation table I'm kind of screwed. It > > seems to ignore the fact that I'm using :join_table => > > 'pb_prod.users_roles" for the relationship definition (pb_prod is the > > external database) and isn't picking up which database to use from > > either object (connection :pushbroom). > > > So it looks to me, at the moment, as though I'm stuck. It does bother > > me though that it LOADS the relationships fine. Just seems to be a > > problem on inserts. > > > Again, just spouting what I've found and desperately looking for a > > solution. Would prefer to find out I'm just being an idiot instead of > > having to implement some solution with seriously high code smell. > > Short of finding and squashing the bug, one not-too-smelly alternative > might be to make a real model for users_roles, like this: > > class UsersRoles < ActiveRecord::Base > establish_connection :pushbroom > set_primary_key nil > > belongs_to :user_account, :class_name => 'PushBroom::UserAccount' > belongs_to :user_role, :class_name => 'PushBroom::UserRole' > end > > then you could replace the habtm call with a set of > has_many :throughs, which shouldn't have the same problem (since > you've explicitly told Rails the join table is on the :pushbroom > connection). > > --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

