Sha256: 6219819b09832789b259221de275a9fe61199ed17c2ac0976b0e3d544df88f41
Contents?: true
Size: 665 Bytes
Versions: 41
Compression:
Stored size: 665 Bytes
Contents
namespace :solidus do namespace :migrations do namespace :migrate_shipping_rate_taxes do task up: :environment do print "Adding persisted tax notes to historic shipping rates ... " Spree::ShippingRate.where.not(tax_rate_id: nil).find_each do |shipping_rate| tax_rate = Spree::TaxRate.unscoped.find(shipping_rate.tax_rate_id) shipping_rate.taxes.find_or_create_by!( tax_rate: tax_rate, amount: tax_rate.compute_amount(shipping_rate) ) end Spree::ShippingRate.where.not(tax_rate_id: nil).update_all(tax_rate_id: nil) puts "Success." end end end end
Version data entries
41 entries across 41 versions & 1 rubygems