Class: Logistics::Core::BreakBulkCargoDetail
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Logistics::Core::BreakBulkCargoDetail
- Defined in:
- app/models/logistics/core/break_bulk_cargo_detail.rb
Instance Method Summary collapse
- #change_to_hash(items) ⇒ Object
- #get_break_bulk_cargo_by_status_and_request(status, bol_id) ⇒ Object
- #to_json ⇒ Object
Methods inherited from ApplicationRecord
Instance Method Details
#change_to_hash(items) ⇒ Object
44 45 46 47 48 49 50 |
# File 'app/models/logistics/core/break_bulk_cargo_detail.rb', line 44 def change_to_hash(items) data = [] items.each { |item| data.push item.to_json } return data end |
#get_break_bulk_cargo_by_status_and_request(status, bol_id) ⇒ Object
38 39 40 41 42 |
# File 'app/models/logistics/core/break_bulk_cargo_detail.rb', line 38 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 |
#to_json ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/models/logistics/core/break_bulk_cargo_detail.rb', line 12 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 |