flipper-active_record 0.9.2 → 0.10.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/docs/active_record/README.md +1 -1
- data/lib/flipper-active_record.rb +3 -1
- data/lib/flipper/adapters/active_record.rb +18 -17
- data/lib/flipper/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c39c77c110ea2fabbb235d60080285abe795d74b
|
4
|
+
data.tar.gz: feb1be36149e4414fb9fbd6bf4d26e47bf8c9729
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a69c32996685fe2dc4c68328274c341756577dd666a6a313634f56895c052ce7e81710d6973b06c131dbd1a6c372d11e335ff6ef61205849a7155dd2cca41dae
|
7
|
+
data.tar.gz: 6fadb40b2807c08fe983ec02063656ac37244c7084cf313c205cfcc1f79b4538393d12ce2c04c9301c17881c73cc84ad0e9fce75d300746b5f0eb32fe5f7ac36
|
@@ -23,7 +23,7 @@ Or install it yourself with:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
For your convenience a migration generator is provided to create the necessary migrations for using the active record adapter
|
26
|
+
For your convenience a migration generator is provided to create the necessary migrations for using the active record adapter. By default this generates a migration that will create two database tables - flipper_features and flipper_gates.
|
27
27
|
|
28
28
|
$ rails g flipper:active_record
|
29
29
|
|
@@ -45,10 +45,11 @@ module Flipper
|
|
45
45
|
|
46
46
|
# Public: Adds a feature to the set of known features.
|
47
47
|
def add(feature)
|
48
|
-
attributes = {key: feature.key}
|
49
48
|
# race condition, but add is only used by enable/disable which happen
|
50
49
|
# super rarely, so it shouldn't matter in practice
|
51
|
-
@feature_class.where(
|
50
|
+
unless @feature_class.where(key: feature.key).first
|
51
|
+
@feature_class.create! { |f| f.key = feature.key }
|
52
|
+
end
|
52
53
|
true
|
53
54
|
end
|
54
55
|
|
@@ -111,18 +112,18 @@ module Flipper
|
|
111
112
|
key: gate.key
|
112
113
|
).delete_all
|
113
114
|
|
114
|
-
@gate_class.create!
|
115
|
-
feature_key
|
116
|
-
key
|
117
|
-
value
|
118
|
-
|
115
|
+
@gate_class.create! do |g|
|
116
|
+
g.feature_key = feature.key
|
117
|
+
g.key = gate.key
|
118
|
+
g.value = thing.value.to_s
|
119
|
+
end
|
119
120
|
end
|
120
121
|
when :set
|
121
|
-
@gate_class.create!
|
122
|
-
feature_key
|
123
|
-
key
|
124
|
-
value
|
125
|
-
|
122
|
+
@gate_class.create! do |g|
|
123
|
+
g.feature_key = feature.key
|
124
|
+
g.key = gate.key
|
125
|
+
g.value = thing.value.to_s
|
126
|
+
end
|
126
127
|
else
|
127
128
|
unsupported_data_type gate.data_type
|
128
129
|
end
|
@@ -148,11 +149,11 @@ module Flipper
|
|
148
149
|
key: gate.key
|
149
150
|
).delete_all
|
150
151
|
|
151
|
-
@gate_class.create!
|
152
|
-
feature_key
|
153
|
-
key
|
154
|
-
value
|
155
|
-
|
152
|
+
@gate_class.create! do |g|
|
153
|
+
g.feature_key = feature.key
|
154
|
+
g.key = gate.key
|
155
|
+
g.value = thing.value.to_s
|
156
|
+
end
|
156
157
|
end
|
157
158
|
when :set
|
158
159
|
@gate_class.where(feature_key: feature.key, key: gate.key, value: thing.value).delete_all
|
data/lib/flipper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flipper
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.10.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.10.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|