Class: Admin::PlansController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PlansController
- Defined in:
- app/controllers/tang/admin/plans_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /plans.
-
#destroy ⇒ Object
DELETE /plans/1.
-
#edit ⇒ Object
GET /plans/1/edit.
-
#index ⇒ Object
GET /plans.
-
#new ⇒ Object
GET /plans/new.
-
#show ⇒ Object
GET /plans/1.
-
#update ⇒ Object
PATCH/PUT /plans/1.
Instance Method Details
#create ⇒ Object
POST /plans
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/tang/admin/plans_controller.rb', line 28 def create @plan = Plan.new(plan_create_params) if @plan.save redirect_to [:admin, @plan], notice: 'Plan was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE /plans/1
48 49 50 51 |
# File 'app/controllers/tang/admin/plans_controller.rb', line 48 def destroy @plan.destroy redirect_to admin_plans_url, notice: 'Plan was successfully destroyed.' end |
#edit ⇒ Object
GET /plans/1/edit
24 25 |
# File 'app/controllers/tang/admin/plans_controller.rb', line 24 def edit end |
#index ⇒ Object
GET /plans
8 9 10 11 12 |
# File 'app/controllers/tang/admin/plans_controller.rb', line 8 def index @plans = Plan.all. paginate(page: params[:page]). order(:name) end |
#new ⇒ Object
GET /plans/new
19 20 21 |
# File 'app/controllers/tang/admin/plans_controller.rb', line 19 def new @plan = Plan.new end |
#show ⇒ Object
GET /plans/1
15 16 |
# File 'app/controllers/tang/admin/plans_controller.rb', line 15 def show end |
#update ⇒ Object
PATCH/PUT /plans/1
39 40 41 42 43 44 45 |
# File 'app/controllers/tang/admin/plans_controller.rb', line 39 def update if @plan.update(plan_update_params) redirect_to [:admin, @plan], notice: 'Plan was successfully updated.' else render :edit end end |