Sha256: 5f380fd4174cfe9f86250a3033eaa6ff4b1f68339a50c63203920cf0d821604a

Contents?: true

Size: 543 Bytes

Versions: 9

Compression:

Stored size: 543 Bytes

Contents

module Logistics
  module Core
    class WarehouseRatePeriod < ApplicationRecord
      validates  :warehouse_id, :from, :to, :rate_period, presence: true
      belongs_to :warehouse

      def self.generate_rate_period_matrix
        warehouses = Warehouse.all
        warehouses.each { |warehouse|
          w = WarehouseRatePeriod.where('warehouse_id' => warehouse.id)
          if w.count == 0
            WarehouseRatePeriod.create('warehouse_id' => warehouse.id, 'from' => 0, 'to' => 0)
          end
        }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logistics_core-21.11.2 app/models/logistics/core/warehouse_rate_period.rb
logistics_core-21.11.1 app/models/logistics/core/warehouse_rate_period.rb
logistics_core-21.08.1 app/models/logistics/core/warehouse_rate_period.rb
logistics_core-21.03.1 app/models/logistics/core/warehouse_rate_period.rb
logistics_core-20.10.3 app/models/logistics/core/warehouse_rate_period.rb
logistics_core-20.10.2 app/models/logistics/core/warehouse_rate_period.rb
logistics_core-20.10.1 app/models/logistics/core/warehouse_rate_period.rb
logistics_core-20.9.1 app/models/logistics/core/warehouse_rate_period.rb
logistics_core-20.8.1 app/models/logistics/core/warehouse_rate_period.rb