Sha256: 07305c13ab7a4d37d88120c9601b9842329c5ac825d77f8b32d616d4602e4921

Contents?: true

Size: 928 Bytes

Versions: 9

Compression:

Stored size: 928 Bytes

Contents

module Logistics
  module Core
    class BroadGaugeBb < ApplicationRecord
      validates :length, :width, :height, :actual_weight, presence: true, allow_blank: false
      validates :break_bulk_unit_id, uniqueness: {scope: [:break_bulk_unit_id, :length, :width, :height, :actual_weight]}

      belongs_to :break_bulk_unit

      def self.fetch_all
        result = []
        broad_gauges = BroadGaugeBb.all
        broad_gauges.each do |broad_gauge|
          result.push({id: broad_gauge.id,
                       break_bulk_unit_id: broad_gauge.break_bulk_unit_id,
                       break_bulk_unit_name: broad_gauge.break_bulk_unit.name,
                       length: broad_gauge.length,
                       width: broad_gauge.width,
                       height: broad_gauge.height,
                       actual_weight: broad_gauge.actual_weight})
        end
        return result
      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/broad_gauge_bb.rb
logistics_core-21.11.1 app/models/logistics/core/broad_gauge_bb.rb
logistics_core-21.08.1 app/models/logistics/core/broad_gauge_bb.rb
logistics_core-21.03.1 app/models/logistics/core/broad_gauge_bb.rb
logistics_core-20.10.3 app/models/logistics/core/broad_gauge_bb.rb
logistics_core-20.10.2 app/models/logistics/core/broad_gauge_bb.rb
logistics_core-20.10.1 app/models/logistics/core/broad_gauge_bb.rb
logistics_core-20.9.1 app/models/logistics/core/broad_gauge_bb.rb
logistics_core-20.8.1 app/models/logistics/core/broad_gauge_bb.rb