Skip to content

Utilizing multiple gates for the same feature flag #738

Answered by bkeepers
slants3 asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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 :qualified_customers group, you also need to enable the secondary feature:

Flipper.enable_group(:search, :qualified_customers)

# Enable for 50% of qualified customers
Flipper.enable_percentage_of_actors(:s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@slants3
Comment options

Answer selected by bkeepers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants