7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/global_shared_db/task_helper.rb', line 7
def connect_shared_db
if defined?(Octopus)
ActiveRecord::Base.octopus_establish_connection(
GlobalSharedDb.db_config[GlobalSharedDb.env]
)
elsif defined?(DbCharmer)
ActiveRecord::Base.db_magic(connection: GlobalSharedDb.db_config)
else
ActiveRecord::Base.establish_connection(GlobalSharedDb.db_config)
end
ActiveRecord::Tasks::DatabaseTasks.instance_eval do
instance_variable_set(:@root, Pathname.new(GlobalSharedDb.root))
instance_variable_set(:@env, GlobalSharedDb.env)
end
end
|