Deploying Features Trough Feature Switches
Normally, when a new feature goes live, we use to do a new deploy to enable it. Some time ago however, I needed to enable a certain Feature on a Sunday. I don't like the idea of having to work on a weekend, especially not if it involves deploying. So I came up with a few lines of code that would automatically enable the feature when the time is right:
[@language="ruby"]
[@caption="xample in ruby."]
def foobar
end
ruby
class Ruby
def dosomestuff
end
end
def foo
"asdf"
end
Basically, you define the conditions for the Feature to be live inside the Proc, and then use Feature.is_enabled? :key to build conditions into the code.
Of course, this has come in handy for serveral other use cases, like having a certain feature live on the dev server, but not on production.