Sha256: 0fd56882308255c74ac4c3180ee930d6ab2f92b30bb95acfb700a6c6e8fa85b9
Contents?: true
Size: 773 Bytes
Versions: 22
Compression:
Stored size: 773 Bytes
Contents
module Spree # Spree::OrderPromotion represents the relationship between: # # 1. A promotion that a user attempted to apply to their order # 2. The specific code that they used class OrderPromotion < Spree::Base self.table_name = 'spree_orders_promotions' belongs_to :order, class_name: 'Spree::Order' belongs_to :promotion, class_name: 'Spree::Promotion' belongs_to :promotion_code, class_name: 'Spree::PromotionCode' validates :order, presence: true validates :promotion, presence: true validates :promotion_code, presence: true, if: :require_promotion_code? self.whitelisted_ransackable_associations = %w[promotion_code] private def require_promotion_code? promotion && promotion.codes.any? end end end
Version data entries
22 entries across 22 versions & 1 rubygems