shackles 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,11 @@ module Shackles
19
19
 
20
20
  def self.included(klass)
21
21
  klass.send(:remove_method, :config)
22
+ klass.alias_method_chain :initialize, :deep_symbolize
23
+ end
24
+
25
+ def initialize_with_deep_symbolize(config, adapter_method)
26
+ initialize_without_deep_symbolize(config.deep_symbolize_keys, adapter_method)
22
27
  end
23
28
 
24
29
  def config
@@ -29,7 +34,12 @@ module Shackles
29
34
  @current_config_sequence = Shackles.global_config_sequence
30
35
  config = @config.dup
31
36
  if @config.has_key?(Shackles.environment)
32
- config.merge!(@config[Shackles.environment].symbolize_keys)
37
+ env_config = @config[Shackles.environment]
38
+ # an array of databases for this environment; for now, just choose the first non-nil element
39
+ if env_config.is_a?(Array)
40
+ env_config = env_config.detect { |individual_config| !individual_config.nil? }
41
+ end
42
+ config.merge!(env_config.symbolize_keys)
33
43
  end
34
44
 
35
45
  config.keys.each do |key|
@@ -1,3 +1,3 @@
1
1
  module Shackles
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shackles
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-09 00:00:00.000000000 Z
12
+ date: 2013-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord