Browse Source

增加复制商品功能

abiao 5 years ago
parent
commit
0c163b29af
1 changed files with 4 additions and 4 deletions
  1. 4 4
      app/models/product.rb

+ 4 - 4
app/models/product.rb

@@ -7,7 +7,8 @@ class Product < ActiveRecord::Base
     attr_accessor :v_share_img,:get_size_enum,:gross_interest_rate
     after_find :get_size_enum
     after_create :after_create
-    after_update :after_update
+    #after_update :after_update
+    before_save :before_save
     def after_create
         #主商品默认关联商品
         if self.show_flag
@@ -15,11 +16,10 @@ class Product < ActiveRecord::Base
             self.save
         end
     end
-    def after_update
-        #若取消,则用户卡次数加1
+    def before_save
+        #主商品默认关联商品
         if self.show_flag
             self.relate_product_id = self.id
-            self.save
         end
     end
     TYPE_ENUM = [["直营","direct_sale"]]