lib/octopus/proxy.rb in ar-octopus-0.0.21 vs lib/octopus/proxy.rb in ar-octopus-0.0.22

- old
+ new

@@ -10,10 +10,15 @@ @shards = {} @groups = {} @shards[:master] = ActiveRecord::Base.connection_pool() @current_shard = :master - shards_config = config[Octopus.env()]["shards"] if have_config_for_enviroment?(config) + if have_config_for_enviroment?(config) && Octopus.rails? + shards_config = config[Octopus.env()][Rails.env().to_s]["shards"] + elsif have_config_for_enviroment?(config) + shards_config = config[Octopus.env()]["shards"] + end + shards_config ||= [] shards_config.each do |key, value| if value.has_key?("adapter") initialize_adapter(value['adapter'])