diff --git a/app/models/concerns/stageable.rb b/app/models/concerns/stageable.rb index f6acd144a06106afa8583c0ae4d5d6853db26ab9..11c76968e9485d1bafd64e37eb5c5ac0a37aa9b6 100644 --- a/app/models/concerns/stageable.rb +++ b/app/models/concerns/stageable.rb @@ -45,4 +45,11 @@ module Stageable StageRelation.where(educational_stage: educational_stage, stageable: self).destroy_all end end + + def update_educational_stages(ids: []) + stageable = self + old_ids = stageable.educational_stages.map {|es| es.id } + add_educational_stages(ids: ids - old_ids) + remove_educational_stages(ids: old_ids - ids) + end end