activerecord-configurations 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record/configurations.rb +18 -0
- data/lib/active_record/configurations/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c84c59199a11dea7a668c68197d2707a38a3080d75d370e537524f00b213fffb
|
4
|
+
data.tar.gz: 7160db9971e047109912617920f63d24c75984dac0163f70a6496ae1fb497d22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7da5b7b4b2c81d2736dada12e86f1ca4df568223b4de8bcb27d73e02fa4dcae0b0f46d9f9d00cdd6a6621c50f03c456c21e325d688984d967d59318fcaa9ef95
|
7
|
+
data.tar.gz: 35dd2f396d3d5c14f9a3528a8eb5e0395f682b1081495d59ac8cc866b4170541d90a84874bf13c848cc637e21db898d7186afc1addd799ef4add6f136e57cd36
|
@@ -116,6 +116,24 @@ module ActiveRecord
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
+
def configuration? name
|
120
|
+
self.configurations.include? name.to_s
|
121
|
+
end
|
122
|
+
|
123
|
+
def requires_connection? name
|
124
|
+
if self.connected?
|
125
|
+
return false
|
126
|
+
end
|
127
|
+
|
128
|
+
return self.configuration?(name)
|
129
|
+
end
|
130
|
+
|
131
|
+
def setup_connection(name = DATABASE_ENV)
|
132
|
+
if requires_connection?(name)
|
133
|
+
self.establish_connection(name)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
119
137
|
def configure(name, parent: :default, &block)
|
120
138
|
parent = self.lookup_environment(parent)
|
121
139
|
|