To Only remove task templates and recreate
# find source team
src_team = Team.find 836
# find each org
iserve = Organization.find 575
idirect = Organization.find 574
idirect_operable_teams = idirect.teams.where.not(id: 836)
iserve_operable_teams = iserve.teams
# remove old templates first
idirect_operable_teams.each { |t| t.loan_file_templates.destroy_all }
iserve_operable_teams.each { |t| t.loan_file_templates.destroy_all }
iserve_operable_teams.each do |dst_team|
src_team.loan_file_templates.order(:id).each do |loan_file_template|
LoanFileTemplates::CopyTemplateToAnotherTeam.perform(loan_file_template, dst_team)
end
end
idirect_operable_teams.each do |dst_team|
src_team.loan_file_templates.order(:id).each do |loan_file_template|
LoanFileTemplates::CopyTemplateToAnotherTeam.perform(loan_file_template, dst_team)
end
end