Class: Admin::FeatureFlagsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Admin::FeatureFlagsController
- Defined in:
- app/controllers/admin/feature_flags_controller.rb
Defined Under Namespace
Classes: Collection
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#feature_flag ⇒ Object
readonly
Returns the value of attribute feature_flag.
Instance Method Summary collapse
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
7 8 9 |
# File 'app/controllers/admin/feature_flags_controller.rb', line 7 def collection @collection end |
#feature_flag ⇒ Object (readonly)
Returns the value of attribute feature_flag.
7 8 9 |
# File 'app/controllers/admin/feature_flags_controller.rb', line 7 def feature_flag @feature_flag end |
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/admin/feature_flags_controller.rb', line 25 def create @feature_flag = FeatureFlag.build(key: params.expect(feature_flag: [:key]).fetch(:key, nil)) if feature_flag.save redirect_to(admin_feature_flag_path(feature_flag), status: :see_other) else render(:new, locals: { feature_flag: }, status: :unprocessable_content) end end |
#destroy ⇒ Object
41 42 43 44 45 |
# File 'app/controllers/admin/feature_flags_controller.rb', line 41 def destroy feature_flag.destroy redirect_to(admin_feature_flags_path, status: :see_other) end |
#index ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/admin/feature_flags_controller.rb', line 9 def index @collection = Collection.with_params(params).apply(FeatureFlag.all) render locals: { collection: } end |
#new ⇒ Object
19 20 21 22 23 |
# File 'app/controllers/admin/feature_flags_controller.rb', line 19 def new @feature_flag = FeatureFlag.build render locals: { feature_flag: } end |
#show ⇒ Object
15 16 17 |
# File 'app/controllers/admin/feature_flags_controller.rb', line 15 def show render locals: { feature_flag:, groups: Flipper.group_names } end |
#update ⇒ Object
35 36 37 38 39 |
# File 'app/controllers/admin/feature_flags_controller.rb', line 35 def update feature_flag.update(feature_flag_params) redirect_to(admin_feature_flags_path, status: :see_other) end |