Feature Flags are one of my favorite patterns. Ross at Flickr blogged a pretty good description on the Flickr Code blog in 2009, and a Ruby gem ‘rails-settings’ appeared in 2009 to give Rails developers a “Global Hash” which can be used to implement feature flags. This has been forked by a handful of people, updated to work with Rails 3, adding support for settings associated with models, etc.
However, the official rails-settings gem hasn’t been updated since 2009 and many of the forks are not of an acceptable level of quality for us to use. Some have removed tests, some have lots of backwards compatability code, and most are pretty hard to read. I spoke with some other developers and decided to build a new one from scratch, using rails-settings as the inspiration, so here we are!
Setler is a new from-scratch Gem that allows developers to easily implement the Feature Flags pattern. It uses the same database structure as rails-settings and has a very similar function call interface, so switching over should be pretty easy. I’ll quickly accept good pull requests (that have good tests) and update the Gem, so if you use Setler you can be confident in it keeping up to date with your needs and continuing to provide well-tested new functionality. I’ll also be quick to respond to any bug or feature requests, and if they’re good, they’ll get implemented. So check it out!
While this is all shiny and new, and mostly similar to rails-settings, a few things have been removed. At Highgroove we like being biased towards simplicity so there is no more support for Rails 2 or Ruby 1.8. You’ll need Rails 3 and Ruby 1.9 to use Setler.
Here’s a sampling of some of the things we’ve used Setler for already: