Class: Spree::ProductPublication

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/product_publication.rb

Overview

Per-channel publication record. A Product is “published” on a Channel when a ProductPublication exists for that pair; the optional window (published_at/unpublished_at) gates customer visibility.

The owning Store is derived via channel.store — no store_id column lives on this table. Historic core had a spree_products_stores join that also carried the Product↔Store relation; in 5.5+ that responsibility moves onto Spree::Product#store_id directly, leaving this table single-purpose.

Instance Method Summary collapse

Instance Method Details

#published?Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'app/models/spree/product_publication.rb', line 30

def published?
  (published_at.nil? || published_at <= Time.current) &&
    (unpublished_at.nil? || unpublished_at > Time.current)
end