Last active
August 11, 2016 16:30
-
-
Save german/88665a10653cdd00182b53cc75f85f73 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
premium_yearly_sub = Subscription.all.detect{|s| s.subscription_type.name == 'yearly' && s.product.name == "aupeo-premium"} | |
saved = 0 | |
sub_mappings = SubscriptionMapping.where(external_subscription_id: "com.aupeo.subscription.europe.yearly") | |
sub_mappings.each do |sm| | |
sm.subscription_id = premium_yearly_sub.id | |
if sm.save | |
puts "Subscription mapping's subscription_id was set for #{sm.country_code}" | |
saved +=1 | |
else | |
puts "Error: #{sm.errors.inspect}" | |
end | |
end | |
puts "Changed #{saved} out of #{sub_mappings.count} subscription mappings" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment