Displaying 1 result from an estimated 1 matches for "all_servers".
Did you mean:
add_servers
2009 Jan 13
2
Connect multiple DB in rails project using AR
...ass 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.
all_servers = Server.find(:all)
all_servers.each do |s|
h = {:host => "localhost",
:adapter => "jdbc",
:dialect => "sybase",
:autocommit => false,
:driver => "com.sybase.jdbc3.jdbc.SybDataSource",
:url => "...