Sha256: ccc57308887b19bd5eac3bc025471324046c9d475b0715fd93f5f72feafd9cd6

Contents?: true

Size: 404 Bytes

Versions: 5

Compression:

Stored size: 404 Bytes

Contents

class TaxCategory < ActiveRecord::Base
  validates_presence_of :name
  validates_uniqueness_of :name

  has_many :tax_rates

  def before_save
    #set existing default tax category to false if this one has been marked as default

    if is_default && tax_category = TaxCategory.find(:first, :conditions => {:is_default => true})
      tax_category.update_attribute(:is_default, false)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spree-0.11.4 app/models/tax_category.rb
spree-0.11.3 app/models/tax_category.rb
spree-0.11.2 app/models/tax_category.rb
spree-0.11.1 app/models/tax_category.rb
spree-0.11.0 app/models/tax_category.rb