Class: WorkflowKit::WorkflowsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- WorkflowKit::WorkflowsController
- Defined in:
- app/controllers/workflow_kit/workflows_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /workflows POST /workflows.json.
-
#destroy ⇒ Object
DELETE /workflows/1 DELETE /workflows/1.json.
-
#edit ⇒ Object
GET /workflows/1/edit.
-
#execute ⇒ Object
PUT /workflows/1/execute.
-
#index ⇒ Object
GET /workflows GET /workflows.json.
-
#new ⇒ Object
GET /workflows/new GET /workflows/new.json.
-
#show ⇒ Object
GET /workflows/1 GET /workflows/1.json.
-
#update ⇒ Object
PUT /workflows/1 PUT /workflows/1.json.
Instance Method Details
#create ⇒ Object
POST /workflows POST /workflows.json
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 46 def create @workflow = Workflow.new(params[:workflow]) respond_to do |format| if @workflow.save format.html { redirect_to @workflow, notice: 'Workflow was successfully created.' } format.json { render json: @workflow, status: :created, location: @workflow } else format.html { render action: "new" } format.json { render json: @workflow.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /workflows/1 DELETE /workflows/1.json
76 77 78 79 80 81 82 83 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 76 def destroy @workflow.destroy respond_to do |format| format.html { redirect_to workflows_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /workflows/1/edit
41 42 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 41 def edit end |
#execute ⇒ Object
PUT /workflows/1/execute
86 87 88 89 90 91 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 86 def execute @workflow.execute( params ) flash[ :notice ] = "#{I18n.t(:executed_workflow)}: #{@workflow.name}" redirect_to :back end |
#index ⇒ Object
GET /workflows GET /workflows.json
11 12 13 14 15 16 17 18 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 11 def index @workflows = Workflow.all respond_to do |format| format.html # index.html.erb format.json { render json: @workflows } end end |
#new ⇒ Object
GET /workflows/new GET /workflows/new.json
31 32 33 34 35 36 37 38 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 31 def new @workflow = Workflow.new respond_to do |format| format.html # new.html.erb format.json { render json: @workflow } end end |
#show ⇒ Object
GET /workflows/1 GET /workflows/1.json
22 23 24 25 26 27 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 22 def show respond_to do |format| format.html # show.html.erb format.json { render json: @workflow } end end |
#update ⇒ Object
PUT /workflows/1 PUT /workflows/1.json
62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 62 def update respond_to do |format| if @workflow.update_attributes(params[:workflow]) format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @workflow.errors, status: :unprocessable_entity } end end end |