Parcourir la source

增加商品属性定义

abiao il y a 5 ans
Parent
commit
bd124fdba5
1 fichiers modifiés avec 2 ajouts et 3 suppressions
  1. 2 3
      app/models/product.rb

+ 2 - 3
app/models/product.rb

@@ -5,12 +5,12 @@ class Product < ActiveRecord::Base
     belongs_to :merchant, :foreign_key => :merchant_id
     validates :name,:buy_price,:price,:category_id,:count,:robo_balance_price, presence: true
     attr_accessor :v_share_img,:get_size_enum,:gross_interest_rate
-    #after_find :get_size_enum
+    after_find :get_size_enum
     TYPE_ENUM = [["直营","direct_sale"]]
     #["代销","user_sale"]
-
     SIZE_ENUM =  []
     def get_size_enum
+        IZE_ENUM.clear
         if SIZE_ENUM.length ==0
             @Size = ProductAttrConfig.where("product_id=? and size_type='size'",self.id).first
             if !@Size.blank?
@@ -21,7 +21,6 @@ class Product < ActiveRecord::Base
                 end
             end
         end
-        return "--"
     end
     IMG_STORE_PATH = "product"