flipper-active_record 1.3.4 → 1.3.6
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/lib/flipper/adapters/active_record.rb +12 -7
- data/lib/flipper/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e57f7c82518727c259e650255afa1d8efd820e903f77e6c674e023bfdc7d127
|
4
|
+
data.tar.gz: a2c9efa80d93b1f4b110eb63aa7b52bede748dd434ea4833cc41aa3833482930
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a14d913ed677ffbbeca3d2adc45ca704009e4e214b152a5758d5936ef42a2e9419b41e6fdbf9d2a704a61a2758f9add7d5a4d1da56dd08a71a5be42487e654a2
|
7
|
+
data.tar.gz: 7909e3048c672f61c2a92ac2a639cb301615178748b2e97fc4c2885161bce81b21977ccc7ac67b7c61edf173189f87dc391062e25cdf4125a4e4ffbb9925a8b4
|
@@ -9,7 +9,6 @@ module Flipper
|
|
9
9
|
include ::Flipper::Adapter
|
10
10
|
|
11
11
|
ActiveSupport.on_load(:active_record) do
|
12
|
-
# Abstract base class for internal models
|
13
12
|
class Model < ::ActiveRecord::Base
|
14
13
|
self.abstract_class = true
|
15
14
|
end
|
@@ -41,7 +40,7 @@ module Flipper
|
|
41
40
|
end
|
42
41
|
|
43
42
|
VALUE_TO_TEXT_WARNING = <<-EOS
|
44
|
-
Your database needs migrated to use the latest Flipper features.
|
43
|
+
Your database needs to be migrated to use the latest Flipper features.
|
45
44
|
Run `rails generate flipper:update` and `rails db:migrate`.
|
46
45
|
EOS
|
47
46
|
|
@@ -59,10 +58,8 @@ module Flipper
|
|
59
58
|
# can roll your own tables and what not, if you so desire.
|
60
59
|
def initialize(options = {})
|
61
60
|
@name = options.fetch(:name, :active_record)
|
62
|
-
@feature_class = options.fetch(:feature_class) { Feature }
|
63
|
-
@gate_class = options.fetch(:gate_class) { Gate }
|
64
|
-
|
65
|
-
warn VALUE_TO_TEXT_WARNING if value_not_text?
|
61
|
+
@feature_class = options.fetch(:feature_class) { Flipper::Adapters::ActiveRecord::Feature }
|
62
|
+
@gate_class = options.fetch(:gate_class) { Flipper::Adapters::ActiveRecord::Gate }
|
66
63
|
end
|
67
64
|
|
68
65
|
# Public: The set of known features.
|
@@ -289,15 +286,23 @@ module Flipper
|
|
289
286
|
# Check if value column is text instead of string
|
290
287
|
# See https://github.com/flippercloud/flipper/pull/692
|
291
288
|
def value_not_text?
|
292
|
-
@gate_class
|
289
|
+
with_connection(@gate_class) do |connection|
|
290
|
+
@gate_class.column_for_attribute(:value).type != :text
|
291
|
+
end
|
293
292
|
rescue ::ActiveRecord::ActiveRecordError => error
|
294
293
|
# If the table doesn't exist, the column doesn't exist either
|
295
294
|
warn "#{error.message}. You likely need to run `rails g flipper:active_record` and/or `rails db:migrate`."
|
296
295
|
end
|
297
296
|
|
298
297
|
def with_connection(model = @feature_class, &block)
|
298
|
+
warn VALUE_TO_TEXT_WARNING if !warned_about_value_not_text? && value_not_text?
|
299
299
|
model.connection_pool.with_connection(&block)
|
300
300
|
end
|
301
|
+
|
302
|
+
def warned_about_value_not_text?
|
303
|
+
return @warned_about_value_not_text if defined?(@warned_about_value_not_text)
|
304
|
+
@warned_about_value_not_text = true
|
305
|
+
end
|
301
306
|
end
|
302
307
|
end
|
303
308
|
end
|
data/lib/flipper/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: flipper
|
@@ -15,14 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 1.3.
|
18
|
+
version: 1.3.6
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 1.3.
|
25
|
+
version: 1.3.6
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activerecord
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +73,7 @@ metadata:
|
|
73
73
|
homepage_uri: https://www.flippercloud.io
|
74
74
|
source_code_uri: https://github.com/flippercloud/flipper
|
75
75
|
bug_tracker_uri: https://github.com/flippercloud/flipper/issues
|
76
|
-
changelog_uri: https://github.com/flippercloud/flipper/releases/tag/v1.3.
|
76
|
+
changelog_uri: https://github.com/flippercloud/flipper/releases/tag/v1.3.6
|
77
77
|
funding_uri: https://github.com/sponsors/flippercloud
|
78
78
|
rdoc_options: []
|
79
79
|
require_paths:
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
|
-
rubygems_version: 3.6.
|
92
|
+
rubygems_version: 3.6.9
|
93
93
|
specification_version: 4
|
94
94
|
summary: ActiveRecord feature flag adapter for Flipper
|
95
95
|
test_files:
|