mongoid_feature_flags 0.1.22 → 0.1.25
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongoid_feature_flags.rb +3 -3
- metadata +1 -1
@@ -41,7 +41,7 @@ module Mongoid
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def features
|
44
|
-
inherited_feature_flags.merge(self.feature_flags)
|
44
|
+
(inherited_feature_flags || {}).merge(self.feature_flags || {})
|
45
45
|
end
|
46
46
|
|
47
47
|
def feature?(*required_features, &block)
|
@@ -65,8 +65,8 @@ module Mongoid
|
|
65
65
|
def inherited_feature_flags
|
66
66
|
if self.class.instance_variable_defined?("@feature_flag_parents")
|
67
67
|
self.class.instance_variable_get("@feature_flag_parents").inject({}) do |flag_hash, relative|
|
68
|
-
if self.respond_to?(relative) && self.send(relative).present? && self.send(relative).respond_to?(:
|
69
|
-
flag_hash.merge(self.send(relative).send(:
|
68
|
+
if self.respond_to?(relative) && self.send(relative).present? && self.send(relative).respond_to?(:features)
|
69
|
+
flag_hash.merge(self.send(relative).send(:features) || {})
|
70
70
|
else
|
71
71
|
flag_hash
|
72
72
|
end
|