Sha256: 5f3e9c66e812e6ed302fa69ab27d5ad68a01ab954d69c8032b596bcfe0d9cc2f

Contents?: true

Size: 868 Bytes

Versions: 7

Compression:

Stored size: 868 Bytes

Contents

require 'earth/model'

require 'earth/shipping/carrier'
require 'earth/shipping/shipment_mode'

class CarrierMode < ActiveRecord::Base
  extend Earth::Model

  TABLE_STRUCTURE = <<-EOS

CREATE TABLE carrier_modes
  (
     name                            CHARACTER VARYING(255) NOT NULL PRIMARY KEY,
     carrier_name                    CHARACTER VARYING(255),
     mode_name                       CHARACTER VARYING(255),
     package_volume                  FLOAT,
     route_inefficiency_factor       FLOAT,
     transport_emission_factor       FLOAT,
     transport_emission_factor_units CHARACTER VARYING(255)
  );

EOS

  self.primary_key = "name"
  
  belongs_to :carrier, :foreign_key => 'carrier_name', :primary_key => 'name'
  belongs_to :mode,    :foreign_key => 'mode_name',    :primary_key => 'name', :class_name => 'ShipmentMode'

  warn_unless_size 9
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
earth-1.2.1 lib/earth/shipping/carrier_mode.rb
earth-1.1.2 lib/earth/shipping/carrier_mode.rb
earth-1.1.1 lib/earth/shipping/carrier_mode.rb
earth-1.1.0 lib/earth/shipping/carrier_mode.rb
earth-1.0.3 lib/earth/shipping/carrier_mode.rb
earth-1.0.2 lib/earth/shipping/carrier_mode.rb
earth-1.0.1 lib/earth/shipping/carrier_mode.rb