Class: Toogle::FeaturesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Toogle::FeaturesController
- Defined in:
- app/controllers/toogle/features_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/toogle/features_controller.rb', line 45 def destroy ::Feature.remove(params[:id]) respond_to do |format| format.html do redirect_to features_url, status: :see_other end format.json do head :ok end end end |
#index ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'app/controllers/toogle/features_controller.rb', line 3 def index load_features respond_to do |format| format.html format.json { render json: @features } end end |
#show ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/toogle/features_controller.rb', line 12 def show @definition = Toogle::Definition.find(params[:id]) if @definition.nil? flash.now[:notice] = "No feature definition with name \"#{params[:id]}\" found." end load_features respond_to do |format| format.html { render "index" } format.json { render json: @features } end end |
#update ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/toogle/features_controller.rb', line 25 def update id = params[:id].to_sym if params[:state] == "enabled" ::Feature.enable(id) elsif params[:state] == "disabled" ::Feature.disable(id) end respond_to do |format| format.html do redirect_to features_url end format.json do head :ok end end end |