Using two Databases to a single application

How to use two databases to a single application?

Questions by suganyaRamesh

  
Showing Answers 1 - 0 of 0 Answers

ericfeng

  • Sep 30th, 2009
 

This is for Ruby on Rails.
1. Set the database at config/database.yml. ex
 mydb:
    adapter: mysql
    database: mydb
    socket: /tmp/mysql.sock
    username: login
    password: password
2. Add a establish_connection line in the model using this database. ex.
 class Account < ActiveRecord::Base
 end
 Account.establish_connection(:mydb)
   

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions