开发者

Running both MongoDB and Mysql on Rails 2.3.6

开发者 https://www.devze.com 2023-04-13 06:41 出处:网络
In Rails 2.3.6 I\'m trying to use both MongoDb via MongoMapper and Mysql on the same application. I\'ve seen several others question about this but I cannot find how to configure rails to use bo开发者

In Rails 2.3.6 I'm trying to use both MongoDb via MongoMapper and Mysql on the same application.

I've seen several others question about this but I cannot find how to configure rails to use bo开发者_开发百科th database in the same app.

How should I configure my database.yml file? Right now it is:

development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: blinddog_development
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

test:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: blinddog_rails_test
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

production:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: blinddog_rails_production
  pool: 5
  username: root
  password: 
  socket: /tmp/mysql.sock

Should I add some intializers?

Thanks in advance, Augusto


So you would use active record and standard database.yml file. You would also run rails g mongo_mapper:config to create your mongo.yml file. These are seperate and should allow you to use both in your model. This would work for mongoid too.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号