Coming soon! A Pro version of the Flipper gem for entirely local installations.

Get Updates

Documentation

Groups

Enable features for a set of actors that share a common trait, which is determined by a configurable block at runtime.

Turn on feature based on the return value of block. Super flexible way to turn on a feature for multiple things (users, people, accounts, etc.) as long as the thing returns true when passed to the block.

Registering a group

Use Flipper.register in an initializer to register a new group. The block passed to register will be called with the actor and a feature context when enabled? is called.

config/initializers/flipper.rb
# Define the block that will return true or false based on actor.
# Registers a group named admins .
Flipper.register(:admins) do |actor, context|
  actor.respond_to?(:admin?) && actor.admin?
end

Since Flipper allows any object to be an actor, check that actor.respond_to?(…) before calling a method on it.

Enabling a feature for a group

A feature can be enabled for a group by calling enable_group with the name of the feature and the group.

Flipper.enable_group(:documentation, :admins)

Example

When a feature is enabled for a group, calls to Flipper.enabled? with an actor will check if the actor is in that group.

user  = User.where(admin: false).first # user who returns false for admin? method
admin = User.where(admin: true).first # user who returns true for admin? method

# The feature is not enabled for a normal user
Flipper.enabled?(:documentation, user) # false

# The feature is enabled for an admin user.
Flipper.enabled?(:documentation, admin) # true
Ready to try it out?

Get audit history, rollbacks, advanced permissions, analytics, and all of your projects in one place.


Prefer our Cloudless option?

You can choose from several tiers to sponsor Flipper on GitHub and get some great benefits!

The Friday Deploy

Get updates for all things Flipper—open source and cloud.

Have questions? Need help?

Email us any time or head on over to our documentation or status page for the latest on the app or API.

Ready to take Flipper for a swim?

No credit card required. 14-day free trial. And customer support directly from the developers.