model里连接非默认的数据库

比如在databases.yml里配置了一个cms_production,

# -*- encoding : utf-8 -*-
class CmsAaat < ActiveRecord::Base
  establish_connection "cms_#{Rails.env}".to_sym

你可能感兴趣的:(Ruby,Rails,models)