Sha256: 5d7d218c05df6bcb5c29cd238635ddf4c08dcbdd5d1d7628e96a398561005bb8

Contents?: true

Size: 587 Bytes

Versions: 3

Compression:

Stored size: 587 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 :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.7 app/models/shoppe/delivery_service_price.rb
shoppe-0.0.6 app/models/shoppe/delivery_service_price.rb
shoppe-0.0.5 app/models/shoppe/delivery_service_price.rb