Class: RailsWorkflow::OperationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- RailsWorkflow::OperationsController
- Defined in:
- app/controllers/rails_workflow/operations_controller.rb
Instance Method Summary collapse
- #complete ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #pickup ⇒ Object
- #update ⇒ Object
Instance Method Details
#complete ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/rails_workflow/operations_controller.rb', line 50 def complete operation = current_operation if operation.present? operation.complete clear_current_operation redirect_to main_app.root_path end end |
#create ⇒ Object
18 19 20 21 |
# File 'app/controllers/rails_workflow/operations_controller.rb', line 18 def create @operation = Operation.create(permitted_params) redirect_to process_operation_url end |
#destroy ⇒ Object
60 61 62 63 |
# File 'app/controllers/rails_workflow/operations_controller.rb', line 60 def destroy @operation.destroy redirect_to process_operation_url end |
#index ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/controllers/rails_workflow/operations_controller.rb', line 23 def index @operations = OperationDecorator.decorate_collection( parent.try(:operations) || Operation.waiting.order(created_at: :desc) ) respond_with @operations end |
#pickup ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/rails_workflow/operations_controller.rb', line 36 def pickup if @operation.assign(current_user) set_current_operation redirect_to main_app.send( @operation.data[:url_path], *@operation.data[:url_params] ) else redirect_to operations_path end end |
#update ⇒ Object
31 32 33 34 |
# File 'app/controllers/rails_workflow/operations_controller.rb', line 31 def update @operation.update(permitted_params) redirect_to process_operation_url end |