activerecord-configurations 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc90c4ac36e6d74ded195f11d6c39b556a73de7e813f46273c4dfb85089ed7d0
4
- data.tar.gz: 0444f199ea3d6a5f2136adbc8fb3bf77406c42d0aa7e9818d07c56c4e852ddc7
3
+ metadata.gz: 65b9acb517ade0d3a1e879b83394509133d9b7e4a754ca0e71c373b107602070
4
+ data.tar.gz: 73b8f60deeba7461446ee6b5e27aeb56511e2d6d70e9279e1eaa9a634d0acf2b
5
5
  SHA512:
6
- metadata.gz: e4692e5d5b597391b88aa7e3f6aa41091ed8650edde75760669fdc46c143c396cdd1981101a330154f159fb394ce569b5c55b08061d4ade1284244579f118a3d
7
- data.tar.gz: 8567c7b3e11ed9302ae8b07568b938fb0613975a8168c3ce2d5aa9e8df84fd523d114cd31e63680f590325e40cfc87623ca9cd944cd30a7c61dbb8328eb9347b
6
+ metadata.gz: 17ace681ea622e45f0cfb81d9386604300b69bbd5341aa3251d78ea69f6451616fef91d5bdda59db1784ffcbc229cec7237926ab2065e244f9548e4e6cc75287
7
+ data.tar.gz: 9bb97abc5785e5b76e30fa79ee1d6bdc3b197ee4130c620d412eabfa4402ce6a78be6658eff0d1bc829d5a5613a961c494248ecbc71b2f2643ced0455116c822
data/.travis.yml CHANGED
@@ -1,10 +1,10 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 2.1
5
4
  - 2.2
6
5
  - 2.3
7
6
  - 2.4
7
+ - 3.5
8
8
  - ruby-head
9
9
  - jruby-head
10
10
  - rbx-2
@@ -113,5 +113,20 @@ module ActiveRecord
113
113
 
114
114
  self.configurations[name.to_s] = configuration.stringify_keys
115
115
  end
116
+
117
+ # This is a quick hack to work around https://github.com/rails/rails/pull/32135
118
+ def establish_connection(config = nil)
119
+ raise "Anonymous class is not allowed." unless name
120
+
121
+ config ||= DEFAULT_ENV.call.to_sym
122
+ spec_name = self == Base ? "primary" : name
123
+ self.connection_specification_name = spec_name
124
+
125
+ resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(self.configurations)
126
+ spec = resolver.resolve(config).symbolize_keys
127
+ spec[:name] = spec_name
128
+
129
+ connection_handler.establish_connection(spec)
130
+ end
116
131
  end
117
132
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module ActiveRecord
22
22
  module Configurations
23
- VERSION = "0.2.0"
23
+ VERSION = "0.3.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-configurations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord