Class: Dscf::Credit::SystemConfigsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/dscf/credit/system_configs_controller.rb', line 6

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

    obj
  end
end

#updateObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/dscf/credit/system_configs_controller.rb', line 16

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

  super do
    obj = set_object
    obj.last_updated_by = current_user
    obj
  end
end