Class: FeatureToggle::FeaturesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/feature_toggle/features_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
# File 'app/controllers/feature_toggle/features_controller.rb', line 5

def index
  @features = Feature.all.to_a
end

#toggleObject



9
10
11
12
13
14
15
# File 'app/controllers/feature_toggle/features_controller.rb', line 9

def toggle
  feature = Feature.where(feature: params[:feature], state: params[:state]).first_or_initialize
  feature.enable = (params[:enable] == 'true')
  feature.save

  render nothing: true
end