{"record":{"id":"ccf784eff1b67e99","repo":"spree/spree","slug":"spree-promotion-rules-taxon-is-deprecated-and-w","errorCode":null,"errorMessage":"Spree::Promotion::Rules::Taxon is deprecated and will be removed in Spree 6.1. Use Spree::Promotion::Rules::Category instead.","messagePattern":"Spree::Promotion::Rules::Taxon is deprecated and will be removed in Spree 6\\.1\\. Use Spree::Promotion::Rules::Category instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"spree/core/app/models/spree/promotion/rules/taxon.rb","lineNumber":13,"sourceCode":"# frozen_string_literal: true\n\nmodule Spree\n  class Promotion\n    module Rules\n      # Deprecation alias for Spree::Promotion::Rules::Category, renamed from\n      # Spree::Promotion::Rules::Taxon in 6.0. A true constant alias, so old STI type\n      # strings (`'Spree::Promotion::Rules::Taxon'`) still instantiate correctly until\n      # the Phase 4 migration rewrites them. The warning fires when this file loads.\n      # Removed in 6.1.\n      Taxon = Category\n\n      Spree::Deprecation.warn('Spree::Promotion::Rules::Taxon is deprecated and will be removed in Spree 6.1. Use Spree::Promotion::Rules::Category instead.')\n    end\n  end\nend\n","sourceCodeStart":1,"sourceCodeEnd":17,"githubUrl":"https://github.com/spree/spree/blob/06bf66a8684b9de03210bbb2ddc8c1f5ba522fa2/spree/core/app/models/spree/promotion/rules/taxon.rb#L1-L17","documentation":"In Spree 6.0 the taxon-based promotion rule was renamed to Spree::Promotion::Rules::Category. The file promotion/rules/taxon.rb now contains only a true constant alias (`Taxon = Category`) plus a Spree::Deprecation.warn that fires when the file loads — not when a method is called. Old STI type strings ('Spree::Promotion::Rules::Taxon') still instantiate correctly through the alias until the 6.0 data migration rewrites them; the alias is removed in 6.1.","triggerScenarios":"Anything that causes app/models/spree/promotion/rules/taxon.rb to load: referencing `Spree::Promotion::Rules::Taxon` in code, `type: 'Spree::Promotion::Rules::Taxon'` rows being instantiated (promotion rules table STI), factories/seeds using the old class, or production eager-loading every file under app/models at boot. In development it fires on first reference; with `config.eager_load = true` it fires at boot even with no explicit reference.","commonSituations":"Upgrading to Spree 6.0 with promotion_rule rows whose STI `type` still says 'Spree::Promotion::Rules::Taxon' (data migration not yet run), extensions/decorators referencing the old constant, or old specs/factories. Also appears as boot-time noise in production logs purely from eager load.","solutions":["Replace every code reference to `Spree::Promotion::Rules::Taxon` with `Spree::Promotion::Rules::Category` (grep the app, initializers, factories, specs, and `class_name:` options).","Run the 6.0 taxon→category data migration so promotion rule STI `type` values are rewritten to the Category class string — after that no old-type row loads the alias.","Update extensions/decorators that reference or subclass the old constant to their 6.0-compatible releases.","If the warning appears only at boot from eager loading and no references remain, silence it temporarily with `Spree::Deprecation.silence { Spree::Promotion::Rules::Taxon }`-style wrapping or accept the log noise until 6.1 — but verify the DB has no legacy type strings first."],"exampleFix":"# before\nrule = Spree::Promotion::Rules::Taxon.new\n\n# after\nrule = Spree::Promotion::Rules::Category.new","handlingStrategy":"validation","validationCode":"# Check for legacy STI type strings that instantiate the alias:\nSpree::PromotionRule.where(type: 'Spree::Promotion::Rules::Taxon').exists?\n\n# Check for code references (run in shell):\n# grep -rn \"Promotion::Rules::Taxon\" app/ lib/ config/ spec/ --exclude-dir=tmp\n\n# Fail on load-time deprecations in CI:\nSpree::Deprecation.behavior = :raise","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After a rename-heavy Spree upgrade, grep for the old constant everywhere including class_name: options and factories.","Run the shipped data migrations immediately on upgrade so legacy STI type strings stop instantiating deprecated aliases.","Remember eager loading fires file-load warnings at boot with zero references — don't burn time hunting phantom callers before checking eager_load."],"tags":["ruby","spree","deprecation","promotions","sti-alias","taxon-to-category-rename","eager-load"],"backgroundTag":"ruby-deprecation-warning","analyzedSha":"06bf66a8684b9de03210bbb2ddc8c1f5ba522fa2","analyzedAt":"2026-08-21T14:59:48.125Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}