Class: Wco::OfficeActionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Wco::OfficeActionsController
- Defined in:
- app/controllers/wco/office_actions_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #do_run ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/wco/office_actions_controller.rb', line 6 def create @oa = OA.new params[:oa].permit! :update, @oa if @oa.save flash_notice @oa else flash_alert @oa end redirect_to action: :index end |
#destroy ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/wco/office_actions_controller.rb', line 18 def destroy @oa = OA.find params[:id] :destroy, @oa if @oa.delete flash_notice @oa else flash_alert @oa end redirect_to action: :index end |
#do_run ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/controllers/wco/office_actions_controller.rb', line 29 def do_run @oa = OA.find params[:id] :do_run, @oa out = @oa.do_run puts! out, 'do_run office action' redirect_to request.referrer end |
#edit ⇒ Object
37 38 39 40 |
# File 'app/controllers/wco/office_actions_controller.rb', line 37 def edit @oa = OA.find params[:id] :edit, @oa end |
#index ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/controllers/wco/office_actions_controller.rb', line 42 def index :index, OA @oas = OA.all if params[:status] @oas = @oas.where( status: params[:status] ) end end |
#new ⇒ Object
50 51 52 53 |
# File 'app/controllers/wco/office_actions_controller.rb', line 50 def new @oa = OA.new :new, @oa end |
#show ⇒ Object
55 56 57 58 |
# File 'app/controllers/wco/office_actions_controller.rb', line 55 def show @oa = OA.find params[:id] :show, @oa end |
#update ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/wco/office_actions_controller.rb', line 60 def update @oa = OA.find params[:id] :update, @oa if @oa.update params[:oa].permit! flash_notice @oa else flash_alert @oa end redirect_to action: :index end |