Skip to content

Instantly share code, notes, and snippets.

@yodarjun
Last active September 11, 2019 16:30
Show Gist options
  • Save yodarjun/afe54709534e8afec8ec87da2bce2f60 to your computer and use it in GitHub Desktop.
Save yodarjun/afe54709534e8afec8ec87da2bce2f60 to your computer and use it in GitHub Desktop.
# config/initializers/rollout.rb
ROLLOUT_OPTIONS = YAML.load_file(Rails.root.join(“config”, “rollout.yml”))[Rails.env]
...
# existing code
if Rollout.active?('my_new_feature_1')
# implement new feature code here
end
# lib/rollout.rb
class Rollout
def self.active?(key)
ROLLOUT_OPTIONS[key] || false
end
end
# config/rollout.yml
development:
my_new_feature_1: true
my_new_feature_2: true
test:
my_new_feature_1: true
my_new_feature_2: true
production:
my_new_feature_1: false
my_new_feature_2: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment