diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake index 61f3e2f30..7cd8ddaa8 100644 --- a/lib/tasks/migrate.rake +++ b/lib/tasks/migrate.rake @@ -328,6 +328,26 @@ namespace :migrate do end end end + Role.all.each do |role| + role.user_ids.uniq! + role.save + role.users.each do |user| + unless user.role_ids.include?(role.id) + user.role_ids << role.id + user.save + end + end + end + SubRole.all.each do |sub_role| + sub_role.user_ids.uniq! + sub_role.save + sub_role.users.each do |user| + unless user.sub_role_ids.include?(sub_role.id) + user.sub_role_ids << sub_role.id + user.save + end + end + end end end