Sha256: c418846a7ee077419eb24356d6fbce384a08d38f3581e569b44b319798a32633

Contents?: true

Size: 363 Bytes

Versions: 6

Compression:

Stored size: 363 Bytes

Contents

class CreateCalculatorsForTaxRates < ActiveRecord::Migration
  def self.up
    TaxRate.find(:all).each do |tax_rate|
      case tax_rate.tax_type
      when 'SalesTax' 
        tax_rate.calculator = Calculator::SalesTax.new
      when 'Vat'
        tax_rate.calculator = Calculator::Vat.new
      end
      tax_rate.save!
    end
  end

  def self.down
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
spree-enriquez-0.9.4 db/migrate/20090804090559_create_calculators_for_tax_rates.rb
spree-0.9.4 db/migrate/20090804090559_create_calculators_for_tax_rates.rb
spree-0.9.3 db/migrate/20090804090559_create_calculators_for_tax_rates.rb
spree-0.9.2 db/migrate/20090804090559_create_calculators_for_tax_rates.rb
spree-0.9.1 db/migrate/20090804090559_create_calculators_for_tax_rates.rb
spree-0.9.0 db/migrate/20090804090559_create_calculators_for_tax_rates.rb