Tyler Kocheff
04/17/2023, 6:40 PMuninitialized constant Spree::PromotionAction
. This code worked in a Rails 6 app, but this one's on Rails 7 so maybe this has to do with Zeitwerk. Seems like any initializer which tries to access anything in Spree::
throws an error. Tried surrounding with a to_prepare
and spree.config
but no luck.
require "./app/models/embold/promotion/actions/free_product.rb"
Rails.application.config.spree.promotions.actions << "Embold::Promotion::Actions::FreeProduct"
and the line of free_product.rb
that it's complaining about:
module Embold
module Promotion
module Actions
class FreeProduct < ::Spree::PromotionAction
Jared Norman
require
. You're trying to require an autoloaded constant.Jared Norman
Tyler Kocheff
04/17/2023, 6:46 PMTyler Kocheff
04/17/2023, 6:46 PM