Skip to content

Instantly share code, notes, and snippets.

@timabell
Created July 31, 2019 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timabell/42da425858ebfc5086960291fcdb04d8 to your computer and use it in GitHub Desktop.
Save timabell/42da425858ebfc5086960291fcdb04d8 to your computer and use it in GitHub Desktop.
old_provider = Provider.find_by(provider_code: '1QQ')
new_provider = Provider.find_by(provider_code: '28Y')
old_provider.sites.each { |site| site.provider = new_provider; site.save }
old_provider.courses.each { |course| course.provider = new_provider; course.save }
old_provider.organisations = []
old_provider.enrichments.each { |enrichment| enrichment.destroy }
old_provider.destroy
new_provider.provider_name = 'Yeovil Area Teacher Training Alliance'
new_provider.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment