# Usage:
# 1) Include this file in config/initializers/rollout.rb
# 2) Create a config/rollout.yml file with something like:
# development:
# new_feature: true
# production:
# new_feature: false
# 3) Use Rollout.active?(:new_feature) in your code to conditionally
# determine whether or not to use the new feature
module Rollout
def self.features
@features ||= YAML.load_file(Rails.root.join("config", "rollout.yml"))[Rails.env]
end
def self.features=(value)
@features = value
end
def self.active?(key)
features[key.to_s]
end
end
Simple feature flippers in Rails.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.