I have a rails project which database connection is defined in
database.yml. There is a table call “servers” which have about 40
records, which is a collection of database setting (i.e. Server.name,
Server.port, Server.host)
I know the way to establish multiple connection as below…
class A < ActiveRecord::Base
end
A.establish_connection(a) # a is the database config
class B < ActiveRecord::Base
end
B.establish_connection(b) # b is the database config
repeat and repeat…
However, how can I do this in a block? I have no idea to do so…Please
give me some light.
Thanks for your help
The reason I used this approach is I am building a dashboard application
to monitor over 40 data servers. I need to extract a lot of information
in those servers and display it through web.
If this approach is not appropriate, could someone suggest alternatives
to me?
Million thanks
Valentino
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.