Files
openfoodnetwork/lib/open_food_network/feature_toggle.rb
Jean-Baptiste Bellet b2db63178f Redirect /checkout/whatever to /checkout when split_checkout is activate
+ constraint the legacy checkout routes when `split_checkout` feature is disabled

+ add specs
2023-01-11 10:10:30 +00:00

21 lines
503 B
Ruby

# frozen_string_literal: true
module OpenFoodNetwork
# Feature toggles are configured via Flipper.
#
# - config/initializers/flipper.rb
# - http://localhost:3000/admin/feature-toggle/features
#
module FeatureToggle
def self.enabled?(feature_name, user = nil)
feature = Flipper.feature(feature_name)
feature.add unless feature.exist?
feature.enabled?(user)
end
def self.disabled?(feature_name, user = nil)
!enabled?(feature_name, user)
end
end
end