Class: Wf::FieldsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Wf::FieldsController
- Defined in:
- app/controllers/wf/fields_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/wf/fields_controller.rb', line 15 def create @form = Wf::Form.find(params[:form_id]) @field = @form.fields.new(field_params) if @field.save redirect_to form_path(@form), notice: "field was successfully created." else render :new end end |
#destroy ⇒ Object
25 26 27 28 29 30 |
# File 'app/controllers/wf/fields_controller.rb', line 25 def destroy @form = Wf::Form.find(params[:form_id]) @field = @form.fields.find(params[:id]) @field.destroy render js: "window.location.reload()" end |
#edit ⇒ Object
32 33 34 35 36 |
# File 'app/controllers/wf/fields_controller.rb', line 32 def edit @form = Wf::Form.find(params[:form_id]) @field = @form.fields.find(params[:id]) @form.name, form_path(@form) end |
#new ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/wf/fields_controller.rb', line 9 def new @form = Wf::Form.find(params[:form_id]) @field = @form.fields.new @form.name, form_path(@form) end |
#update ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/wf/fields_controller.rb', line 38 def update @form = Wf::Form.find(params[:form_id]) @field = @form.fields.find(params[:id]) if @field.update(field_params) redirect_to form_path(@form), notice: "field was successfully created." else render :edit end end |