multiple database connections with has_many through

给你一囗甜甜゛ 提交于 2019-12-03 07:00:06

A friend answered this for me, and I figured it might be of some use to others.

class Location < ActiveRecord::Base
  #establish_connection "master"
  def self.table_name() "master.locations" end
  has_many :places
  has_many :users, :through => :places
end

The answer works for me, but I use this version in my relation table:

self.table_name = "master.locations"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!