Originally, I did not like the idea of an ActiveRecord adapter for Flipper. I work on GitHub.com day to day, so everything I do has to be extremely performant. Using ActiveRecord for something like this felt like way too much overhead.
In fact, at GitHub, we use a custom adapter for Flipper built on good old raw SQL. Not only that, but we also use a memcache adapter which wraps the pure SQL adapter to avoid hitting MySQL most of the time. The memcache wrapper (at the time of this writing) works similar to the memoizing adapter that is included with Flipper (for those that are curious).
Over time, a few good options came out for using Flipper with ActiveRecord and they changed my mind. I realized that not every application is GitHub.com. Some applications value ease of integration over performance. I even wrote my own ActiveRecord adapter for SpeakerDeck, which is what I am now including in the core flipper repo (but available as a separate gem).
Drop the gem in your Gemfile:
Generate the migration:
rails g flipper:active_record
require 'flipper/adapters/active_record' adapter = Flipper::Adapters::ActiveRecord.new flipper = Flipper.new(adapter) # profit...
From there, you use flipper the same as you would with any of the previously supported adapters. Internally, all features are stored in a
flipper_features table and all gate related values are stored in a
flipper_gates table. You can see more about the internals in the examples.
As of Flipper 0.7.3, you can now flip features with the easy and comfort of ActiveRecord and the peace of mind that as new AR versions are released, your flipper adapter will be updated and ready to go.
Happy flipping and happy holidays!