From 5a1c1617711c1252cdcd87eff6c18b9d489d24ff Mon Sep 17 00:00:00 2001 From: Phyo Date: Mon, 21 Aug 2017 17:46:16 +0630 Subject: [PATCH] Promotion Relation with PromotionProduct --- app/models/promotion.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/models/promotion.rb b/app/models/promotion.rb index 9b5c4c12..b255ceec 100644 --- a/app/models/promotion.rb +++ b/app/models/promotion.rb @@ -1,2 +1,12 @@ class Promotion < ApplicationRecord + validates_presence_of :promo_code,:promo_start_date,:promo_end_date,:promo_start_hour,:promo_end_hour,:promo_day,:promo_type,:original_product,:min_qty + + has_many :promotion_products + + accepts_nested_attributes_for :promotion_products , :allow_destroy => true + + PROMO_TYPE1 = "Quantity" + PROMO_TYPE2 = "Net_off" + PROMO_TYPE3 = "Net_price" + PROMO_TYPE4 = "Percentage" end