-
Hi! I'm currently working on a project where I'd like to use multiple gates for one feature flag. Basically I'd like to pass in a condition for customers here in a
But once a customer satisfies condition1 and condition2, they are automatically enabled via the flag and the last bit doesn't work. It seems like I see in a comment here that Flipper basically enables the flag once any of the gates are enabled so I'm unsure what I'm looking for here is possible. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @slants3, just to rephrase to make sure I understand: you want to enable a feature for half of the users in the One way to approach this would be to have the group then call Flipper.register(:qualified_customers) do |actor, context|
actor.condition_1? &&
actor.condition_2? &&
Flipper.enabled?("#{context.feature_name}_for_qualified_customers", actor)
end Now when you enable a feature for the Flipper.enable_group(:search, :qualified_customers)
# Enable for 50% of qualified customers
Flipper.enable_percentage_of_actors(:search_for_qualified_customers, 50)
# Enable for qualified customers that are also VIPs
Flipper.enable_group(:search_for_qualified_customers, :vip)
# Enable for all qualified customers
Flipper.enable_group(:search_for_qualified_customers)
# Enable for everyone
Flipper.enable(:search) This approach gives you full runtime control over which users get the feature so you don't have to redeploy to change the group requirements. Does that achieve what you wanted? |
Beta Was this translation helpful? Give feedback.
Hey @slants3, just to rephrase to make sure I understand: you want to enable a feature for half of the users in the
:qualified_customers
group?One way to approach this would be to have the group then call
Flipper.enabled?
for a dynamically generated feature name:Now when you enable a feature for the
:qualified_customers
group, you also need to enable the secondary feature: