Sha256: 7a75784b4251e258783aa3b3f3ca0ed31430b5a7ddd09e791051394b0ec25ed0

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

module Shoppe
  class TaxRate < ActiveRecord::Base
    
    # Set the table name
    self.table_name = 'shoppe_tax_rates'
    
    # Validations
    validates :name, :presence => true
    validates :rate, :numericality => true
    
    # Relationships
    has_many :products, :dependent => :restrict_with_exception
    has_many :delivery_service_prices, :dependent => :restrict_with_exception
    
    # Scopes
    scope :ordered, -> { order("shoppe_tax_rates.id")}
    
    def description
      "#{name} (#{rate}%)"
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoppe-0.0.11 app/models/shoppe/tax_rate.rb