Skip to content

Instantly share code, notes, and snippets.

@pythonandchips
Last active July 15, 2019 10:01
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 pythonandchips/5748f418ed632c8a2815bd62afd80246 to your computer and use it in GitHub Desktop.
Save pythonandchips/5748f418ed632c8a2815bd62afd80246 to your computer and use it in GitHub Desktop.
Back fill currency on bills
progress_bar = ProgressBar.new(Company.count)
Company.all.find_in_batches.each do |companies|
companies.pluck(:id, :native_currency).each do |(company_id, native_currency)|
progress_bar.increment!
Bill.where(company_id: company_id).update_all(currency: native_currency)
end
end
@davepilling
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment