Skip to content

Commit

Permalink
Mod: Migration 里面加入容错
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Apr 2, 2011
1 parent 61c149f commit f70452f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions db/migrate/20110402113515_total_user_answered_ask_ids.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
class TotalUserAnsweredAskIds < Mongoid::Migration
def self.up
User.all.each do |u|
u.answered_ask_ids = u.answers.collect { |a| a.ask_id }
u.save
begin
u.answered_ask_ids = u.answers.collect { |a| a.ask_id }
u.save
rescue
end
end
end

Expand Down

0 comments on commit f70452f

Please sign in to comment.