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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a58d7441fee7b7c75e3d9d00edfbe47eb2d91d5050e5b0234b082c5ce8853cf4
4
- data.tar.gz: bd1e280da830e16b57e1c216e16fdc36b54cdd44995cdb0f0ee97544ca29f8f8
3
+ metadata.gz: c84c59199a11dea7a668c68197d2707a38a3080d75d370e537524f00b213fffb
4
+ data.tar.gz: 7160db9971e047109912617920f63d24c75984dac0163f70a6496ae1fb497d22
5
5
  SHA512:
6
- metadata.gz: fc8d8522f44a473ebcf322001657925962c587f03851ad6f5e0283aed75aac8aeddacb20aa8d91aca0356f21e89e69952a498c46fe6317cbf9f7cf98c67e4c9c
7
- data.tar.gz: a909956f9eff542f6e36a1e051f48adde3886a09a9b1c4b7e03b2fd17fa4e11b473c5bad715129983bfd581d71cacb77667871bffa06ef6e4de1cf8f95f42c3d
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
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module ActiveRecord
22
22
  module Configurations
23
- VERSION = "0.4.0"
23
+ VERSION = "0.5.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-configurations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams