Ich versuche, auf Produkte über die Werbeaktion zuzugreifen, dies jedoch nicht.Zuordnung von der Werberichtlinie zum Produkt funktioniert nicht
In der Befehlszeile: Promotion.last.promotion_rules.first.products
Gibt einen Fehler eines nicht initialisierten konstant.
Hier sind meine Assoziationen:
class Product
has_many :product_promotion_rules, class_name: 'ProductPromotionRule'
has_many :promotion_rules, through: :product_promotion_rules
end
class ProductPromotionRule
belongs_to :product
belongs_to :promotion_rule
end
class PromotionRule
has_many :product_promotion_rules, class_name: 'ProductPromotionRule', join_table: 'products_promotion_rules', foreign_key: :promotion_rule_id
has_many :products, through: :product_promotion_rules
belongs_to :promotion
end
class Promotion
has_many :promotion_rules
end
Bitte den Fehler anzeigen. – MTarantini
NameError: nicht initialisierte Konstante Promotion :: Regeln :: ProductValue :: ProductPromotionRule –