Files
grecia/app/controllers/concerns/feature_flags.rb
Julian Herrero c82b2a975a Add new settings tab for participation processes
- Rename setting keys
- New tab por participation processes
- Hide these settings from features tab
2019-03-19 19:45:32 +01:00

26 lines
492 B
Ruby

module FeatureFlags
extend ActiveSupport::Concern
class_methods do
def feature_flag(name, *options)
before_action(*options) do
check_feature_flag(name)
end
end
end
def check_feature_flag(name)
raise FeatureDisabled, name unless Setting["feature.#{name}"] || Setting["process.#{name}"]
end
class FeatureDisabled < Exception
def initialize(name)
@name = name
end
def message
"Feature disabled: #{@name}"
end
end
end