Explorar o código

增加商品属性定义

abiao %!s(int64=5) %!d(string=hai) anos
pai
achega
68aea1027d
Modificáronse 1 ficheiros con 2 adicións e 6 borrados
  1. 2 6
      app/models/product.rb

+ 2 - 6
app/models/product.rb

@@ -4,12 +4,12 @@ class Product < ActiveRecord::Base
     belongs_to :product_cat, :foreign_key => :category_id
     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,:get_color_enum
+    attr_accessor :v_share_img,:get_size_enum,:gross_interest_rate
     after_find :get_size_enum
-    after_find :get_color_enum
     TYPE_ENUM = [["直营","direct_sale"]]
     #["代销","user_sale"]
     SIZE_ENUM =  []
+    COLOR_ENUM =  []
     def get_size_enum
         SIZE_ENUM.clear
         if SIZE_ENUM.length ==0
@@ -22,10 +22,6 @@ class Product < ActiveRecord::Base
                 end
             end
         end
-    end
-
-    COLOR_ENUM =  []
-    def get_color_enum
         COLOR_ENUM.clear
         if COLOR_ENUM.length==0
             @Color = ProductAttrConfig.where("product_id=? and size_type='color'",self.id).first