Skip to content
Snippets Groups Projects
Commit 5313a125 authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

add function to update edutional stages in learning objects put

parent acbaf1d9
No related branches found
No related tags found
No related merge requests found
...@@ -45,4 +45,11 @@ module Stageable ...@@ -45,4 +45,11 @@ module Stageable
StageRelation.where(educational_stage: educational_stage, stageable: self).destroy_all StageRelation.where(educational_stage: educational_stage, stageable: self).destroy_all
end end
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 end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment