Sha256: 1168b249274c41503aeee140c3eb522d42b9977ffa21b99ef467643f83533ee4

Contents?: true

Size: 656 Bytes

Versions: 3

Compression:

Stored size: 656 Bytes

Contents

class Shoppe::DeliveryServicePrice < ActiveRecord::Base

  # Set the table name
  self.table_name = 'shoppe_delivery_service_prices'
  
  # Relationships
  belongs_to :delivery_service, :class_name => 'Shoppe::DeliveryService'
  
  # Validations
  validates :price, :numericality => true
  validates :cost_price, :numericality => true, :allow_blank => true
  validates :tax_rate, :numericality => true
  validates :min_weight, :numericality => true
  validates :max_weight, :numericality => true
  
  # Scopes
  scope :ordered, -> { order('price asc')}
  scope :for_weight, -> weight { where("min_weight <= ? AND max_weight >= ?", weight, weight) }
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shoppe-0.0.10 app/models/shoppe/delivery_service_price.rb
shoppe-0.0.9 app/models/shoppe/delivery_service_price.rb
shoppe-0.0.8 app/models/shoppe/delivery_service_price.rb