Can we put any number of databases in YML file?

Hi --

Another way of using database.yml (separate from environments) is to
store separate connections that may only be used by a few models in an
application. You can specify all of the database details in
database.yml, then connect to them in your model i.e.


adapter: mysql

database: anotherdatabase

username: dbuser

host: someotherhost

Then in the models that will use this connection:

establish_connection :some_other_db

I have used this a few times and it works well. It has the benefit of
keeping all db connection information in one place rather than
specifying it directly in establish_connection.

(See Agile page 293)