Sha256: 499687c67252756b251a02ed7b55c65da6e08571a650a3a64d2acc9c287b65e9
Contents?: true
Size: 1.97 KB
Versions: 9
Compression:
Stored size: 1.97 KB
Contents
module Logistics module Core class BreakBulkCargoDetail < ApplicationRecord belongs_to :break_bulk_unit belongs_to :cargo_type belongs_to :content_type belongs_to :offer_request belongs_to :service_delivery_unit #has_many :item_transport_requests has_many :review_notes, as: :correspondence def to_json JSON.parse( Jbuilder.encode do |json| json.id self.id json.weight self.actual_weight json.quantity self.quantity json.content_type_id self.content_type_id json.content_type_name self.content_type ? self.content_type.name : nil json.offer_request_id self.offer_request_id json.cargo_type_id self.cargo_type_id json.cargo_type_name self.cargo_type ? self.cargo_type.name : nil json.description self.description json.cargo_name self.break_bulk_unit ? self.break_bulk_unit.name : nil json.break_bulk_unit_id self.break_bulk_unit_id json.break_bulk_unit_name self.break_bulk_unit ? self.break_bulk_unit.name : nil json.truck_number self.truck_number json.volume self.volume json.length self.length json.height self.height json.width self.width json.service_delivery_unit_id self.service_delivery_unit_id json.service_delivery_unit_name self.service_delivery_unit ? self.service_delivery_unit.name : nil end ) end def get_break_bulk_cargo_by_status_and_request(status, bol_id) break_bulk_cargo = BreakBulkCargoDetail.where(status: status, offer_request_id: bol_id) break_bulk_cargo = change_to_hash(break_bulk_cargo) return break_bulk_cargo end def change_to_hash(items) data = [] items.each { |item| data.push item.to_json } return data end end end end
Version data entries
9 entries across 9 versions & 1 rubygems