Class: Ecom::Core::UnitCost

Inherits:
ApplicationRecord show all
Defined in:
app/models/ecom/core/unit_cost.rb

Instance Method Summary collapse

Instance Method Details

#update_previous_unit_costObject



16
17
18
19
20
21
22
23
24
# File 'app/models/ecom/core/unit_cost.rb', line 16

def update_previous_unit_cost
  return if resource_type_id.nil?

  return if active_changed?(from: true, to: false)

  Ecom::Core::UnitCost
    .where(resource_type_id: resource_type_id, active: true)
    .update(active: false)
end