Commit 79cbe005f65bdc614a879f8e22e6b1ac61b37b8a

Authored by Nathan Broadbent
1 parent 89595a9a
Exists in master and in 1 other branch production

Tidied migration

db/migrate/20110905134638_link_errs_to_problems.rb
... ... @@ -10,9 +10,7 @@ class LinkErrsToProblems < Mongoid::Migration
10 10  
11 11 # Create a Problem for each Err
12 12 Err.all.each do |err|
13   - app_id = err['app_id']
14   - app = app_id && App.where(:_id => app_id).first
15   - if app
  13 + if err['app_id'] && app = App.where(:_id => err['app_id']).first
16 14 err.problem = app.problems.create
17 15 err.save
18 16 end
... ... @@ -25,3 +23,4 @@ class LinkErrsToProblems < Mongoid::Migration
25 23 def self.down
26 24 end
27 25 end
  26 +
... ...