Skip to content

Commit 20b5e14

Browse files
author
John Pinto
committed
Fix for bug in Plan duplication results in original plan identifier being copied.
Changes (suggested by @aaronskiba): - removed an unnecessary line plan_copy.identifier = nil - cast to string the integer-valued plan id plan_copy.identifier = plan_copy.id.to_s
1 parent 36e5b7d commit 20b5e14

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

app/models/plan.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,9 @@ def self.deep_copy(plan)
254254
plan_copy = plan.dup
255255
plan_copy.title = "Copy of #{plan.title}"
256256
plan_copy.feedback_requested = false
257-
# Don't copy the identifier as it will be regenerated
258-
plan_copy.identifier = nil
259257
plan_copy.save!
260258
# Copy newly generated Id to the identifier
261-
plan_copy.identifier = plan_copy.id
259+
plan_copy.identifier = plan_copy.id.to_s
262260
plan.save!
263261
plan.answers.each do |answer|
264262
answer_copy = Answer.deep_copy(answer)

0 commit comments

Comments
 (0)