Class: EditRequestsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#add_breadcrumb, #after_sign_in_path_for, #breadcrumbs, #new_session_path, #render_not_found, #require_admin_user

Instance Method Details

#editObject

GET /edit_requests/1/edit



10
11
12
13
# File 'app/controllers/edit_requests_controller.rb', line 10

def edit
  add_breadcrumb(@request_model.project_title, request_path(@request_model))
  add_breadcrumb("Edit Submitted Request")
end

#updateObject

PATCH/PUT /edit_requests/1 or /edit_requests/1.json



16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/edit_requests_controller.rb', line 16

def update
  respond_to do |format|
    if @request_model.update(request_params) && @request_model.valid_to_submit?
      format.html { redirect_to request_url(@request_model), notice: I18n.t(:successful_update) }
      format.json { render :show, status: :ok, location: @request_model }
    else
      format.html { render :edit, status: :unprocessable_entity }
      format.json { render json: @request_model.errors, status: :unprocessable_entity }
    end
  end
end