Open Yu-Chieh-Henry-Yang opened 5 years ago
@briri @xsrust apologies one more of those where I am not sure whether this is still relevant (?)
@xsrust was this the deep copy you just cleaned up during the Rails5 upgrade?
This looks to be a different issue from that cleanup.
I had a quick-look and the initial concerns (double-template-generation) seem valid in the current code so it's worth addressing: https://github.com/DMPRoadmap/roadmap/blame/rails5/app/controllers/concerns/versionable.rb#L67-L73
Inside app/controllers/concerns/versionable.rb
new_template = Template.find_or_generate_version!(template)
already deep copy the whole template, so we shouldn't need to do it again herebecause we are just adding new elements like Phase, Section, Question, or Annotation. I think lines
obj = obj.send(:deep_copy)
can be removed, what do people think?(@Bodacious I saw you editing these 2 lines so I thought I might tag you here.)