Class: Wf::FormsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/wf/forms_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#wf_current_user

Instance Method Details

#createObject



43
44
45
46
47
48
49
50
51
# File 'app/controllers/wf/forms_controller.rb', line 43

def create
  @form = Wf::Form.new(form_params)

  if @form.save
    redirect_to forms_path, notice: "form was successfully created."
  else
    render :new
  end
end

#destroyObject



25
26
27
28
29
30
31
32
# File 'app/controllers/wf/forms_controller.rb', line 25

def destroy
  @form = Wf::Form.find(params[:id])
  @form.destroy
  respond_to do |format|
    format.html { redirect_to forms_path, notice: "form was successfully deleted." }
    format.js { render js: "window.location.reload();" }
  end
end

#editObject



17
18
19
# File 'app/controllers/wf/forms_controller.rb', line 17

def edit
  @form = Wf::Form.find(params[:id])
end

#indexObject



9
10
11
# File 'app/controllers/wf/forms_controller.rb', line 9

def index
  @forms = Wf::Form.order("id DESC").page(params[:page])
end

#newObject



13
14
15
# File 'app/controllers/wf/forms_controller.rb', line 13

def new
  @form = Wf::Form.new
end

#showObject



21
22
23
# File 'app/controllers/wf/forms_controller.rb', line 21

def show
  @form = Wf::Form.find(params[:id])
end

#updateObject



34
35
36
37
38
39
40
41
# File 'app/controllers/wf/forms_controller.rb', line 34

def update
  @form = Wf::Form.find(params[:id])
  if @form.update(form_params)
    redirect_to form_path(@form), notice: "form was successfully updated."
  else
    render :edit
  end
end