在我的 Rails 应用程序中,我需要在应用程序中使用多个数据库。但是我怎么能告诉rails,这个表必须来自这个数据库,另一个 - 来自另一个。我正在使用mysql。现在配置看起来像这样:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: Mycorp_development
pool: 5
username: root
password: root
socket: /var/run/mysqld/mysqld.sock
和一个模型(我知道那不是在 rails-way,但 db 不是我的)
class Article < ActiveRecord::Base
attr_accessible :ART_ID, :ART_ARTICLE_NR, :ART_SUP_ID, :ART_DES_ID, :ART_COMPLETE_DES_ID, :ART_CTM, :ART_PACK_SELFSERVICE, :ART_MATERIAL_MARK, :ART_REPLACEMENT, :ART_ACCESSORY, :ART_BATCH_SIZE1, :ART_BATCH_SIZE2, :QUANTITYM, :PRICEM
set_table_name "ARTICLES"
set_primary_key :ART_ID
end