Class: CatalogItemRepriceReference

Inherits:
ApplicationRecord show all
Defined in:
app/models/catalog_item_reprice_reference.rb

Overview

Join row scoping which sibling retailer catalogs cap a catalog item's
Amazon price raises: rows present → only those retailers' scrapes cap;
none → every probe-enabled retailer does (no preference).

catalog_id is nullable because the FK is ON DELETE SET NULL — deleting a
catalog must never block on repricing scopes. Orphaned rows are inert:
readers go through the inner-join :reprice_reference_catalogs association.

Constant Summary

Constants included from Models::Schedulable

Models::Schedulable::SIMPLE_FORM_OPTIONS

Instance Attribute Summary collapse

Belongs to collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::Schedulable

config

Methods included from Models::AfterCommittable

#after_commit

Methods included from Models::EventPublishable

#publish_event

Instance Attribute Details

#catalog_idInteger?

Returns Foreign key to the repricing scope catalog.

Returns:

  • (Integer, nil)

    Foreign key to the repricing scope catalog.



18
# File 'app/models/catalog_item_reprice_reference.rb', line 18

validates :catalog_id, uniqueness: { scope: :catalog_item_id }, allow_nil: true

Instance Method Details

#catalogCatalog

Returns:



14
# File 'app/models/catalog_item_reprice_reference.rb', line 14

belongs_to :catalog, optional: true

#catalog_itemCatalogItem

Returns:



12
# File 'app/models/catalog_item_reprice_reference.rb', line 12

belongs_to :catalog_item