【config\database.yml】之简写
base: &baseadapter: postgresqlencoding: UTF8host: localhostusername: xxxpassword: xxxpool: 5timeout: 5000development: &development<<: *basedatabase: app_developmentproduction: &production<<: *basedatabase: app_productiontest: &test<<: *basedatabase: app_test如有不同之处,请自行替换。
另外,补充下哈。
如项目打算用到多个数据库,也可在些配置文件中配置。如:
base: &base......test: &test<<: *basedatabase: app_testanotherdb: &anotherdb<<: *basedatabase: anotherdb
在要用到的Model中这样调用:
class Contact < ActiveRecord::Baseestablish_connection :anotherdb......end
页:
[1]