Last active
December 10, 2015 04:14
-
-
Save ardeearam/f423871f2cde90c2405f to your computer and use it in GitHub Desktop.
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
ReferralDocument.each do |r| | |
begin | |
referral_master = Referral.find(r.referral_id) | |
r.update(service_id: referral_master.master_service.id, reference: referral_master.reference) | |
rescue ActiveRecord::RecordNotFound => ex1 | |
puts ex1.class.name + " " + ex1.message + ". Deleting mongo Referral cache..." | |
r.destroy | |
rescue StandardError => ex2 | |
puts ex2.class.name + " " + ex2.message | |
r.destroy | |
end | |
end | |
#Try also Referral.all.each {|r| r.sync_with_cache} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment