Class: InventoryCommit
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- InventoryCommit
- Includes:
- Models::Auditable
- Defined in:
- app/models/inventory_commit.rb
Overview
== Schema Information
Table name: inventory_commits
Database name: primary
id :integer not null, primary key
deficit :boolean default(FALSE)
expires_on :datetime
kit_component_quantity :integer
quantity :integer not null
created_at :datetime
creator_id :integer
kit_line_item_id :integer
kit_store_item_id :integer
line_item_id :integer not null
store_item_id :integer not null
Indexes
idx_unique_inventory_commits_2col (line_item_id,store_item_id) UNIQUE WHERE (kit_store_item_id IS NULL)
idx_unique_inventory_commits_3col (line_item_id,store_item_id,kit_store_item_id) UNIQUE WHERE (kit_store_item_id IS NOT NULL)
index_inventory_commits_on_kit_line_item_id (kit_line_item_id)
index_inventory_commits_on_line_item_id (line_item_id)
index_inventory_commits_on_store_item_id (store_item_id)
Foreign Keys
fk_rails_... (kit_store_item_id => store_items.id) ON DELETE => nullify
fk_rails_... (line_item_id => line_items.id) ON DELETE => cascade
fk_rails_... (store_item_id => store_items.id) ON DELETE => cascade
Constant Summary
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Belongs to collapse
- #creator ⇒ Party
- #kit_line_item ⇒ LineItem
- #kit_store_item ⇒ StoreItem
- #line_item ⇒ LineItem
-
#store_item ⇒ StoreItem
NOTE: After inventory_commit is created, updated or deleted then the following db triggers will occur in this order: 1.
Methods included from Models::Auditable
Instance Method Summary collapse
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #should_not_save_version, #stamp_record
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Instance Method Details
#can_be_deleted? ⇒ Boolean
50 51 52 |
# File 'app/models/inventory_commit.rb', line 50 def can_be_deleted? line_item.delivery_id.nil? end |
#creator ⇒ Party
44 |
# File 'app/models/inventory_commit.rb', line 44 belongs_to :creator, class_name: 'Party', optional: true |
#kit_line_item ⇒ LineItem
43 |
# File 'app/models/inventory_commit.rb', line 43 belongs_to :kit_line_item, class_name: 'LineItem', optional: true |
#kit_store_item ⇒ StoreItem
42 |
# File 'app/models/inventory_commit.rb', line 42 belongs_to :kit_store_item, class_name: 'StoreItem', optional: true |
#line_item ⇒ LineItem
41 |
# File 'app/models/inventory_commit.rb', line 41 belongs_to :line_item, optional: true |
#store_item ⇒ StoreItem
NOTE: After inventory_commit is created, updated or deleted then the following db triggers will occur in this order:
- inventory_commit_activity (see db for details)
- set_kit_qty_committed (see db/triggers/set_qty_committed.sql for details)
40 |
# File 'app/models/inventory_commit.rb', line 40 belongs_to :store_item, optional: true |