activerecord-configurations 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/lib/active_record/configurations.rb +15 -0
- data/lib/active_record/configurations/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 65b9acb517ade0d3a1e879b83394509133d9b7e4a754ca0e71c373b107602070
|
|
4
|
+
data.tar.gz: 73b8f60deeba7461446ee6b5e27aeb56511e2d6d70e9279e1eaa9a634d0acf2b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17ace681ea622e45f0cfb81d9386604300b69bbd5341aa3251d78ea69f6451616fef91d5bdda59db1784ffcbc229cec7237926ab2065e244f9548e4e6cc75287
|
|
7
|
+
data.tar.gz: 9bb97abc5785e5b76e30fa79ee1d6bdc3b197ee4130c620d412eabfa4402ce6a78be6658eff0d1bc829d5a5613a961c494248ecbc71b2f2643ced0455116c822
|
data/.travis.yml
CHANGED
|
@@ -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
|
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.
|
|
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-
|
|
11
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|