Class: Wf::GuardsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Wf::GuardsController
- Defined in:
- app/controllers/wf/guards_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/wf/guards_controller.rb', line 15 def create @arc = Wf::Arc.find(params[:arc_id]) gp = guard_params.merge(fieldable: GlobalID::Locator.locate(guard_params[:fieldable])) @guard = @arc.guards.new(gp.merge(workflow: @arc.workflow)) redirect_to workflow_arc_path(@arc.workflow, @arc), notice: "only out direction arc can set guard!" unless @arc.out? if @guard.save redirect_to workflow_arc_path(@arc.workflow, @arc), notice: "guard was successfully created." else render :new end end |
#destroy ⇒ Object
27 28 29 30 31 32 |
# File 'app/controllers/wf/guards_controller.rb', line 27 def destroy @arc = Wf::Arc.find(params[:arc_id]) @guard = @arc.guards.find(params[:id]) @guard.destroy render js: "window.location.reload()" end |
#edit ⇒ Object
34 35 36 37 38 39 |
# File 'app/controllers/wf/guards_controller.rb', line 34 def edit @arc = Wf::Arc.find(params[:arc_id]) @guard = @arc.guards.find(params[:id]) @arc.workflow.name, workflow_path(@arc.workflow) @arc.name, workflow_arc_path(@arc.workflow, @arc) end |
#new ⇒ Object
8 9 10 11 12 13 |
# File 'app/controllers/wf/guards_controller.rb', line 8 def new @arc = Wf::Arc.find(params[:arc_id]) @guard = @arc.guards.new @arc.workflow.name, workflow_path(@arc.workflow) @arc.name, workflow_arc_path(@arc.workflow, @arc) end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/wf/guards_controller.rb', line 41 def update @arc = Wf::Arc.find(params[:arc_id]) gp = guard_params.merge(fieldable: GlobalID::Locator.locate(guard_params[:fieldable])) @guard = @arc.guards.find(params[:id]) if @guard.update(gp) redirect_to workflow_arc_path(@arc.workflow, @arc), notice: "guard was successfully created." else render :edit end end |