diff --git a/app/models/role.rb b/app/models/role.rb index 3008aed103c..474bce26560 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -131,6 +131,10 @@ class Role < ActiveRecord::Base @built_in_roles_by_id[shard.id] ||= built_in_roles(reload, shard).index_by(&:id) end + def self.clear_built_in_roles! + @built_in_roles.clear if @built_in_roles + end + def self.built_in_course_roles built_in_roles.select{|role| role.course_role?} end diff --git a/lib/tasks/db_load_data.rake b/lib/tasks/db_load_data.rake index 517bc80049a..7f7ee67cb2c 100644 --- a/lib/tasks/db_load_data.rake +++ b/lib/tasks/db_load_data.rake @@ -129,6 +129,7 @@ namespace :db do raise pseudonym.errors.full_messages.first if pseudonym.errors.size > 0 raise "unknown error saving password" end + Role.clear_built_in_roles! Account.site_admin.account_users.where(user_id: user, role_id: Role.get_built_in_role('AccountAdmin')).first_or_create! Account.default.account_users.where(user_id: user, role_id: Role.get_built_in_role('AccountAdmin')).first_or_create! user