Class: Dscf::Credit::CreditLinesController

Inherits:
ApplicationController show all
Includes:
Dscf::Core::AuditableController, Dscf::Core::Common, Dscf::Core::ReviewableController
Defined in:
app/controllers/dscf/credit/credit_lines_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
# File 'app/controllers/dscf/credit/credit_lines_controller.rb', line 13

def create
  super do
    credit_line = @clazz.new(model_params)
    credit_line.created_by = current_user
    credit_line.reviews.build(status: "draft", context: "default")
    credit_line
  end
end

#updateObject



22
23
24
25
26
27
28
29
30
# File 'app/controllers/dscf/credit/credit_lines_controller.rb', line 22

def update
  unless @obj.editable?
    return render_error(
      errors: [ "Cannot update credit line after submission. Use modification request workflow instead." ],
      status: :unprocessable_entity
    )
  end
  super
end