Feature flags in Rails: How to roll out and manage your features like a pro

Ackshaey Singh
6 min readApr 6

Feature flagging is a widely adopted technique used in software development that enables developers to turn features or sections of their code on or off for different groups of users. It allows for the gradual release of new features to subsets of users, which makes it easier to test and monitor performance before enabling it for everyone. It provides developers with more flexibility and control over their releases, which can help avoid potential issues or rollbacks.

For example, imagine a team is working on a new feature that involves a significant change to the login process for a web app. Without feature flagging, the team would have to deploy the new code to everyone at once, potentially causing breaking the web app for all users. With feature flagging, the team can gradually enable the new login process for specific groups of users, testing and monitoring performance along the way. If any issues arise, the team can quickly turn off the feature flag to avoid widespread issues.

Even if you’re working on your own solo developer low throughput Rails app, feature flagging can be useful in isolating and eliminating problematic releases. I recently had to implement a feature flag system for Firecode.io, which is written primarily in Rails. In this blog post, we will look at how to use the Flipper gem to implement a basic feature flagging system in a Rails application. I have taken semi real examples and code from Firecode.io to illustrate the implementation with an example.

Step 1: Add the Flipper Gem to Your Gemfile

To get started with Flipper, add the following lines to your Gemfile:

### Feature flagging with Flipper
gem 'flipper'
gem 'flipper-active_record'
gem 'flipper-ui'

These gems provide the core functionality for feature flagging with Flipper, as well as a user interface for managing your feature flags.

Step 2: Configure Flipper in Your Application

Ackshaey Singh

Founder @ firecode.io / designerdiscount.club | Ex Staff SWE / Manager @Opendoor | Ex @Twitter Ads Engineering