Class: TaxCategory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- TaxCategory
- Defined in:
- app/models/tax_category.rb
Instance Method Summary collapse
Instance Method Details
#effective_amount(address = nil) ⇒ Object
16 17 18 19 20 |
# File 'app/models/tax_category.rb', line 16 def effective_amount(address=nil) address ||= Address.new(:country_id => Spree::Config[:default_country_id]) self.tax_rates.detect{|rate| rate.zone.include? address }.try(:amount) end |
#set_default_category ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/models/tax_category.rb', line 8 def set_default_category #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 |