Class: EdiDocument
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- EdiDocument
- Defined in:
- app/models/edi_document.rb
Overview
== Schema Information
Table name: edi_documents
Database name: primary
id :integer not null, primary key
note :string
resource_type :string
created_at :datetime not null
updated_at :datetime not null
legacy_amazon_variation_id :integer
catalog_item_id :integer
edi_communication_log_id :integer not null
invoice_id :integer
item_id :integer
order_id :integer
receipt_id :integer
resource_id :integer
Indexes
idx_unique_edi_documents (resource_type,resource_id,edi_communication_log_id) UNIQUE
index_edi_documents_on_legacy_amazon_variation_id (legacy_amazon_variation_id) WHERE (legacy_amazon_variation_id IS NOT NULL)
index_edi_documents_on_catalog_item_id (catalog_item_id) WHERE (catalog_item_id IS NOT NULL)
index_edi_documents_on_edi_communication_log_id (edi_communication_log_id)
index_edi_documents_on_invoice_id (invoice_id) WHERE (invoice_id IS NOT NULL)
index_edi_documents_on_item_id (item_id) WHERE (item_id IS NOT NULL)
index_edi_documents_on_order_id (order_id) WHERE (order_id IS NOT NULL)
index_edi_documents_on_receipt_id (receipt_id) WHERE (receipt_id IS NOT NULL)
Foreign Keys
fk_rails_... (legacy_amazon_variation_id => legacy_amazon_variations.id) ON DELETE => cascade
fk_rails_... (catalog_item_id => catalog_items.id) ON DELETE => cascade
fk_rails_... (edi_communication_log_id => edi_communication_logs.id) ON DELETE => cascade
fk_rails_... (invoice_id => invoices.id) ON DELETE => cascade
fk_rails_... (item_id => items.id) ON DELETE => cascade
fk_rails_... (order_id => orders.id) ON DELETE => cascade
fk_rails_... (receipt_id => receipts.id) ON DELETE => cascade
Constant Summary
Constants included from Models::Schedulable
Models::Schedulable::SIMPLE_FORM_OPTIONS
Belongs to collapse
- #catalog_item ⇒ CatalogItem?
-
#edi_communication_log ⇒ EdiCommunicationLog
belongs_to :resource, polymorphic: true, optional: true.
- #invoice ⇒ Invoice?
- #item ⇒ Item?
- #order ⇒ Order?
- #receipt ⇒ Receipt?
- #variant_group ⇒ VariantGroup?
Instance Method Summary collapse
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::Schedulable
Methods included from Models::AfterCommittable
Methods included from Models::EventPublishable
Instance Method Details
#catalog_item ⇒ CatalogItem?
48 |
# File 'app/models/edi_document.rb', line 48 belongs_to :catalog_item, optional: true |
#edi_communication_log ⇒ EdiCommunicationLog
belongs_to :resource, polymorphic: true, optional: true
46 |
# File 'app/models/edi_document.rb', line 46 belongs_to :edi_communication_log |
#invoice ⇒ Invoice?
54 |
# File 'app/models/edi_document.rb', line 54 belongs_to :invoice, optional: true |
#receipt ⇒ Receipt?
56 |
# File 'app/models/edi_document.rb', line 56 belongs_to :receipt, optional: true |
#resource ⇒ ApplicationRecord?
63 64 65 |
# File 'app/models/edi_document.rb', line 63 def resource catalog_item || item || order || invoice || receipt || variant_group end |
#resource=(val) ⇒ void
This method returns an undefined value.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/models/edi_document.rb', line 69 def resource=(val) case val when CatalogItem self.catalog_item = val when Item self.item = val when Order self.order = val when Invoice self.invoice = val when Receipt self.receipt = val when VariantGroup self.variant_group = val else raise ArgumentError, "Unsupported resource type: #{val.class.name}" end end |
#variant_group ⇒ VariantGroup?
58 |
# File 'app/models/edi_document.rb', line 58 belongs_to :variant_group, optional: true |