Last active
July 15, 2019 10:01
-
-
Save pythonandchips/5748f418ed632c8a2815bd62afd80246 to your computer and use it in GitHub Desktop.
Back fill currency on bills
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
✅