Sha256: 527c8019d861281c5b52542adb249863fb9c1ae0be59da7cde05eec319d0f35a
Contents?: true
Size: 712 Bytes
Versions: 13
Compression:
Stored size: 712 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 < ActiveRecord::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? private def require_promotion_code? promotion && promotion.codes.any? end end end
Version data entries
13 entries across 13 versions & 1 rubygems