Commit d80ac3705b3376c230d54ff4cfc3acfba03b4bab

Authored by Nathan B
2 parents a7d447f5 af91f5bd
Exists in master and in 1 other branch production

Merge pull request #98 from gorenje/migration_fix

Fixed migration from Err to Problem, so that
db/migrate/20110905134638_link_errs_to_problems.rb
@@ -12,7 +12,11 @@ class LinkErrsToProblems < Mongoid::Migration @@ -12,7 +12,11 @@ class LinkErrsToProblems < Mongoid::Migration
12 puts "==== Create a Problem for each Err..." 12 puts "==== Create a Problem for each Err..."
13 Err.all.each do |err| 13 Err.all.each do |err|
14 if err['app_id'] && app = App.where(:_id => err['app_id']).first 14 if err['app_id'] && app = App.where(:_id => err['app_id']).first
15 - err.problem = app.problems.create 15 + err.problem = app.problems.create(:_id => err.id)
  16 + err.problem.resolve! if err.resolved
  17 + # don't bother checking err for issue link, if it ain't got one the NoMethodError
  18 + # is raised, else this works fine.
  19 + err.problem.update_attribute(:issue_link, err.issue_link) rescue NoMethodError
16 err.save 20 err.save
17 end 21 end
18 end 22 end