Module: Spree::ProductDecorator

Defined in:
app/models/spree/product_decorator.rb

Class Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/models/spree/product_decorator.rb', line 3

def self.prepended(base)
  # Fires on every create/update, not gated on saved_change_to_name?
  # etc. — deliberately: taxon/category changes go through a separate
  # join-table save that wouldn't trip a dirty-tracking guard on the
  # product record itself, and SpreeMenuChat::Embedder's own
  # content_hash check already skips the Voyage call when the built
  # content text hasn't actually changed. Catches both Square-driven
  # syncs and manual admin edits alike, with zero coupling to
  # spree_square internals (see the plan's Option A rationale).
  base.after_commit :spree_menu_chat_reembed, on: %i[create update]
end