hai...friends..
how to create multiple mysql database ??pls help
i ve used the following type but it creates only one database
mobile_development..any help pls...
hai...friends..
how to create multiple mysql database ??pls help
i ve used the following type but it creates only one database
mobile_development..any help pls...
I don't know what you've done beyond edit database.yml, but at the
very least you're going to need to indent it properly: the
environment_name1 and environment_name2 entries you've added aren't
indented like the other ones.
thank u for ur kind reply..
development:
adapter: mysql
database: library_development
timeout: 5000
username: root
password:
host: localhost
test:
adapter: mysql
database: library_test
timeout: 5000
username: root
password:
host: localhost
production:
adapter: mysql
database: library_production
timeout: 5000
username: root
password:
its the normal way to connect a data base....how to connect two database
or more like this ...any help pls..am a new one to ruby rails..
hai...friends..
how to create multiple mysql database ??pls help
i ve used the following type but it creates only one database
mobile_development..any help pls...
Theoreticaly you can have every table in its own database, server.
class Mytable < ActiveRecord::Base
establish_connection(:environment_name1)
end
In my case I have multiple tables in each db so I do something like
this:
class FinancialConnection < ActiveRecord::Base
self.abstract_class = true
establish_connection("#{RAILS_ENV}_financials".to_sym)
end
By doing that I can have a development_financials, test_financials,
and production_financials DB and vary the connection for the
environment. Further, by making this connection class an abstract
ARec class I can use it as the superclass for all the financially
related tables:
class Account < FinancialConnection
end
class Journal < FinancialConnection
end
etc
(Note: this relies on the fact that subclasses share the db connection
of their superclass if they do not establish one of their own).