module Logistics module Core class BroadGaugeCnt < ApplicationRecord validates :length, :width, :height, :actual_weight, presence: true, allow_blank: false validates :container_size_id, uniqueness: {scope: [:container_size_id, :container_type_id]} belongs_to :container_size belongs_to :container_type def self.fetch_all result = [] broad_gauges = BroadGaugeCnt.all broad_gauges.each do |broad_gauge| result.push({id: broad_gauge.id, container_size_id: broad_gauge.container_size_id, container_size_name: broad_gauge.container_size.name, container_type_id: broad_gauge.container_type_id, container_type_name: broad_gauge.container_type.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