we have this file structure:
app/services/payment/code_pen_subscription.rb
app/services/promo/promotion_expire.rb
and the modules/classes defined below.
###promotion_expire.rb
module Promo
class PromotionExpire
end
end
###code_pen_subscription.rb
module Payment
class CodePenSubscription
def new_suscription_from_promo
##stuff
Promo::PromotionExpire.new.expire_single(@user, true)
##/stuff
end
end
end
##problem
In production only, we got an exception
NameError: uninitialized constant Payment::Promo::PromotionExpire
To fix, we changed Promo::PromotionExpire
to ::Promo::PromotionExpire
, which tells ruby to look from root of module hierarchy. But we don't know why
- this only happens in production (autoload path?)
- why it only happens in this class, not others.