flipper-active_record 0.9.2 → 0.10.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
  SHA1:
3
- metadata.gz: 145a71a07d72267078564a72cf86174c73d05fbd
4
- data.tar.gz: 02c78cef7141edbd072a4a20ac84de9a4cf7872d
3
+ metadata.gz: c39c77c110ea2fabbb235d60080285abe795d74b
4
+ data.tar.gz: feb1be36149e4414fb9fbd6bf4d26e47bf8c9729
5
5
  SHA512:
6
- metadata.gz: acabd1878c1863cc605a3806f389c1d1860697c989f7da87c41cf169c1c877f13f061b850ad2560477399551e74b3e63a261d374feca69c8c27e2bcb2053c735
7
- data.tar.gz: 9c9de888ed2c438d6c4c41a11c20a29a7b886ba57cd398073e83bff99843d554be43dbd042d8638370b1c3bb853f4091cb4a9f183015d35ee20c732c167d61c2
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
 
@@ -1 +1,3 @@
1
- require 'flipper/adapters/active_record'
1
+ ActiveSupport.on_load(:active_record) do
2
+ require 'flipper/adapters/active_record'
3
+ end
@@ -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(attributes).first || @feature_class.create!(attributes)
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: feature.key,
116
- key: gate.key,
117
- value: thing.value.to_s,
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: feature.key,
123
- key: gate.key,
124
- value: thing.value.to_s,
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: feature.key,
153
- key: gate.key,
154
- value: thing.value.to_s,
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
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = "0.9.2".freeze
2
+ VERSION = "0.10.0".freeze
3
3
  end
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.9.2
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-08-22 00:00:00.000000000 Z
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.9.2
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.9.2
26
+ version: 0.10.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement