From 8f5429a1393ba2344502e7359a09dd9e3a7bf5d0 Mon Sep 17 00:00:00 2001 From: Gabriela Navarro Date: Tue, 14 Jul 2015 13:07:05 +0000 Subject: [PATCH] If this script runs more than once it wont break the search of the block --- update.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/update.rb b/update.rb index c26f090..5dffb3d 100644 --- a/update.rb +++ b/update.rb @@ -11,9 +11,11 @@ softwares.each do |soft| print "." if soft.community.save boxToMove = soft.community.boxes.where(:position => 1).first blockToMove = boxToMove.blocks.where(:type => "SoftwareInformationBlock").first - newBox = soft.community.boxes.where(:position => 4).first - blockToMove.box = newBox - print "." if blockToMove.save + if blockToMove + newBox = soft.community.boxes.where(:position => 4).first + blockToMove.box = newBox + print "." if blockToMove.save + end else soft.destroy end -- libgit2 0.21.2