Class: Dscf::Credit::ScoringTablesController
- Inherits:
-
ApplicationController
- Object
- Dscf::Core::ApplicationController
- ApplicationController
- Dscf::Credit::ScoringTablesController
- Includes:
- Dscf::Core::AuditableController, Dscf::Core::Common, Dscf::Core::ReviewableController
- Defined in:
- app/controllers/dscf/credit/scoring_tables_controller.rb
Instance Method Summary collapse
Instance Method Details
#activate ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/controllers/dscf/credit/scoring_tables_controller.rb', line 37 def activate if @obj.update(active: true) render_success(data: @obj) else render_error(errors: @obj.errors., status: :unprocessable_entity) end end |
#create ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/dscf/credit/scoring_tables_controller.rb', line 18 def create super do scoring_table = @clazz.new(model_params) scoring_table.created_by = current_user scoring_table.reviews.build(context: "default", status: "draft") scoring_table end end |
#deactivate ⇒ Object
45 46 47 48 49 50 51 |
# File 'app/controllers/dscf/credit/scoring_tables_controller.rb', line 45 def deactivate if @obj.update(active: false) render_success(data: @obj) else render_error(errors: @obj.errors., status: :unprocessable_entity) end end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/dscf/credit/scoring_tables_controller.rb', line 27 def update unless @obj.editable? return render_error( errors: [ "Cannot update scoring table after submission. Use modification request workflow instead." ], status: :unprocessable_entity ) end super end |