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
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 47 def create @workflow = Workflow.new(workflow_params) 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
77 78 79 80 81 82 83 84 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 77 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
42 43 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 42 def edit end |
#execute ⇒ Object
PUT /workflows/1/execute
87 88 89 90 91 92 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 87 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
32 33 34 35 36 37 38 39 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 32 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 28 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 22 def show @workflow ||= Workflow.find(params[:id]) 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
63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/workflow_kit/workflows_controller.rb', line 63 def update respond_to do |format| if @workflow.update_attributes(workflow_params) 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 |