Permalink
Browse files

Ignore validation errors in one-time Organization migration

  • Loading branch information...
1 parent d1ba41f commit 66a2ba8a4a5d784d5a139bc7f57f5588d57bf50f @cthielen cthielen committed Feb 26, 2014
Showing with 6 additions and 2 deletions.
  1. +1 −1 config/initializers/last_updated.rb
  2. +5 −1 lib/tasks/organization_tasks.rake
View
2 config/initializers/last_updated.rb
@@ -1 +1 @@
-LAST_UPDATED = 'Tue Feb 25 16:36:53 PST 2014'
+LAST_UPDATED = 'Tue Feb 25 16:43:34 PST 2014'
View
6 lib/tasks/organization_tasks.rake
@@ -175,7 +175,11 @@ namespace :organization do
# Add members from the OU-Group to the Organization
ou_group.members.each do |member|
puts "\t\tAdding member #{member.name} (#{member.type}) to Organization"
- organization.entities << member
+ begin
+ organization.entities << member
+ rescue ActiveRecord::RecordInvalid => e
+ puts "\t\tCould not add member to organization: #{e}. Ignoring ..."
+ end
end
# Remove those members from the OU-Group

0 comments on commit 66a2ba8

Please sign in to comment.