#3178: using a transaction and two save to create an impediment with the appropriate "blocks"-relationship

pull/6827/head
Jens Ulferts 14 years ago
parent fd55e3c187
commit 823eb1a9bb
  1. 10
      app/models/impediment.rb

@ -15,9 +15,13 @@ class Impediment < Task
task.safe_attributes = params
task.remaining_hours = 0 if IssueStatus.find(params[:status_id]).is_closed?
task.blocks_ids = params[:blocks]
if task.save
#an issue relation can not be established between new nodes because their relationship can not be
#evaluated and issue relations between parent and descendant are prohibited. Therefore we need to
#save two times in a transaction
task.transaction do
task.save
task.blocks_ids = params[:blocks]
task.save
task.move_after params[:prev]
end

Loading…
Cancel
Save