From af91f5bd0448195ac87426e51fb945d14fccc5d9 Mon Sep 17 00:00:00 2001 From: Gerrit Riessen Date: Sat, 1 Oct 2011 22:04:57 +0200 Subject: [PATCH] Fixed migration from Err to Problem, so that --- db/migrate/20110905134638_link_errs_to_problems.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/migrate/20110905134638_link_errs_to_problems.rb b/db/migrate/20110905134638_link_errs_to_problems.rb index 3c62147..74f2384 100644 --- a/db/migrate/20110905134638_link_errs_to_problems.rb +++ b/db/migrate/20110905134638_link_errs_to_problems.rb @@ -12,7 +12,11 @@ class LinkErrsToProblems < Mongoid::Migration puts "==== Create a Problem for each Err..." Err.all.each do |err| if err['app_id'] && app = App.where(:_id => err['app_id']).first - err.problem = app.problems.create + err.problem = app.problems.create(:_id => err.id) + err.problem.resolve! if err.resolved + # don't bother checking err for issue link, if it ain't got one the NoMethodError + # is raised, else this works fine. + err.problem.update_attribute(:issue_link, err.issue_link) rescue NoMethodError err.save end end -- libgit2 0.21.2