Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Commit

Permalink
Avoid possible exceptions in CleanUnusedMobilePhones data migration
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Apr 27, 2015
1 parent a8203aa commit 7e45af8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion db/migrate/20150422124519_clean_unused_mobile_phones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ def self.up
# this will run the before_validation check and clean up
# users which have a mobile_suffix and mobile_prefix filled even if not needed
Account.all.each do |user|
user.save!
if user.valid?
user.save
else
puts "Problems with user: #{user.username}, id: #{user.id},\nerrors: #{user.errors}\n\n"
end
end
end

Expand Down

0 comments on commit 7e45af8

Please sign in to comment.